I have problem with rule after signUp and login user. I am using Auth0Lock v10 and option loginAfterSignUp is left as default ( true ).
My rule saves user.email into JWT (accessToken) token (see below), but this email isn’t set in my event callback authenticated. Keys which are in JWT (accessToken) are aud, azp, exp, sub etc. but no https://example.io/email. If I debug rule in Real-time Webtask Logs my console.logs are visible and JWT (accessToken) is properly set, even after first login.
After logout and login again is my JWT (accessToken) token OK and email is visible.
My rule:
function (user, context, callback) {
console.log('add-user_metadata-to-token_id - start');
console.log('add-user_metadata-to-token_id - user ', user);
console.log('add-user_metadata-to-token_id - context: ', context);
var namespace = 'https://example.io/';
context.accessToken[namespace + 'email'] = user.email;
console.log('add-user_metadata-to-token_id - idToken', context.idToken);
console.log('add-user_metadata-to-token_id - accessToken', context.accessToken);
callback(null, user, context);
}
Auth-lock version: 10.24.1
{
leeway: 30,
theme: {
primaryColor: '#6e40ff',
logo: amioLogoImage
},
allowShowPassword: true,
languageDictionary: {
title: ''
},
oidcConformant: true,
autoclose: true,
rememberLastLogin: true,
auth: {
redirectUrl: 'http://localhost:9000/app/login',
autoParseHash: true,
sso: true,
responseType: 'token',
audience: 'https://example.io'
},
additionalSignUpFields: {
name: 'webapp_url',
placeholder: 'webapp_url',
prefill: getAuth0Props().webappUrl
}]
}
Do you have any idea where is the problem or is this some kind of bug?