I have similar situation with accessToken
.
Rule is very simple:
function (user, context, callback) {
context.accessToken'http://XXX.auth0.com/email'] = user.email;
console.log(context.accessToken);
console.log(user.email);
callback(null, user, context);
}
And if I try this rule, I get this :
{ 'http://XX.auth0.com/email': 'jdoe@foobar.com' }
jdoe@foobar.com
The profile is:
{
"name": "jdoe@foobar.com",
"email": "jdoe@foobar.com",
"nickname": "jdoe",
"picture": "http://foobar.com/pictures/jdoe.png",
"user_id": "auth0|0123456789",
"identities":
{
"provider": "auth0",
"user_id": "0123456789",
"connection": "Username-Password-Connection",
"isSocial": false
}
]
}
The rules context is:
{
"clientID": "123456789",
"clientName": "MyWebApp",
"connection": "MyDbConn",
"connectionStrategy": "auth0",
"protocol": "oidc-basic-profile",
"request": {
"query": {
"scope": "openid"
},
"body": {},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36",
"ip": "X.X.X.X",
"geoip": {
"country_code": "AR",
"country_code3": "ARG",
"country_name": "Argentina",
"region": "08",
"city": "Federal",
"postal_code": "3180",
"latitude": -30.954599380493164,
"longitude": -58.78329849243164,
"continent_code": "SA",
"time_zone": "America/Argentina/Buenos_Aires"
}
},
"samlConfiguration": {},
"stats": {
"loginsCount": 5
},
"accessToken": {
"http://XXX.auth0.com/email": "jdoe@foobar.com"
},
"idToken": {}
}
But “http://XXX.auth0.com/email” is not in the accessToken
returned in the response.
Do you have any idea? @jmangelo