I'm currently trying out Auth0 and messing around with a sample app: https://github.com/auth0-samples/auth0-react-native-sample
I am trying to get hold of the user I am logging in as and getting the authId but what I'm getting in return is the client details:
const onLogin = () => {
auth0.webAuth
.authorize({
scope: 'openid profile email'
})
.then(credentials => {
const user = auth0.users(credentials.accessToken);
console.log(user);
Alert.alert('AccessToken: ' + credentials.accessToken);
setAccessToken(credentials.accessToken);
})
.catch(error => console.log(error));
};
Result:
{
"client": {
"telemetry": {
"name": "react-native-auth0",
"version": "2.14.1"
},
"baseUrl": "<BASE URL>",
"domain": "<DOMAIN>",
"bearer": "Bearer <TOKEN>",
"timeout": 10000
}
}
Is there any way to get a hold of the authId via this way?
Found a way to access it via this way:
auth0.auth.userInfo({token: credentials.accessToken}).then(result => {
console.log(result);
});