Hello,
I have this question because I would like to connect Auth0 and my Hygraph account so they can do two things.
Specifically, I would like anyone who registers with my Auth0 app to be automatically sent to my Hygraph panel.
I’ve tried using Auth0 Actions, however, it doesn’t work. I wrote the code below and everything looks fine during testing however when I implement this Actions nothing happens after my registration. No trigger is enabled.
Below I am uploading my code from Actions.
`const axios = require(‘axios’);
/**
-
@param {Event} event - Details about newly created user.
*/
exports.onExecutePostUserRegistration = async (event) => {
try {
const graphQLQuery =mutation RegisterAuthUser($authId: String!, $eMail: String!, $firstName: String!, $lastName: String!, $phoneNumber: String!) { createAuthUser( data: {authId: $authId, eMail: $eMail, firstName: $firstName, lastName: $lastName, phoneNumber: $phoneNumber} ) { authId eMail firstName lastName phoneNumber } }
;const variables = {
authId: event.user.user_id,
eMail: event.user.email,
firstName: event.user.given_name,
lastName: event.user.family_name,
phoneNumber: event.user.phone_number
};const headers = {
Authorization:Bearer ${event.secrets.accessToken}
,
‘Content-Type’: ‘application/json’,
};const response = await axios.post(event.secrets.endpoint, { query: graphQLQuery, variables }, { headers });
const createdUser = response.data.data.createAuthUser;
console.log(‘Utworzono nowego użytkownika:’, createdUser);console.log(‘Dodatkowe informacje wysłane do Hygraph.’);
} catch (error) {
console.error(‘Błąd podczas rejestracji użytkownika:’, error.message);
}
};`
Is it at all possible to connect these two applications to work together without any additional application?