I’m submitting a
- [*] bug report
- [*] feature request
I have this scenario where I can login with the Okta Sign In Widget and it returns the e-mail and the userId (okta) of the user.
I made it work with it but now my client is requesting that I need to set at least the name, so it needs to be done.
The thing is that I see how the /me endpoint it’s returning me the data that I need:
As you can see, in the _links array the name is returned.
But I cannot access it. Using the sessiong.get() function it only retrieves the userId and e-mail.
var oktaSignIn = new OktaSignIn({
baseUrl: 'https://dev-893652.oktapreview.com',
clientId: '0oaj1v2jfyKeTwLR60h7',
redirectUri: 'https://movielearningv4.app.keetup.com',
authParams: {
issuer: 'https://dev-893652.oktapreview.com/oauth2/default',
scopes: ['openid', 'email', 'profile'],
responseType: ['id_token','token'],
display: 'page'
}
});
if (oktaSignIn.token.hasTokensInUrl()) {
oktaSignIn.token.parseTokensFromUrl(function success(res) {
// The tokens are returned in the order requested by `responseType` above
var accessToken = res[0];
var idToken = res[1]
console.log("response", res)
// Say hello to the person who just signed in:
console.log('Hello, ' + res);
// Save the tokens for later use, e.g. if the page gets refreshed:
oktaSignIn.tokenManager.add('accessToken', accessToken);
oktaSignIn.tokenManager.add('idToken', idToken);
oktaSignIn.session.get(function (response) {
// Session exists, show logged in state.
// Doesn't return name
console.log("response", response)
// Remove the tokens from the window location hash
window.location.hash='';
if (res.status === 'ACTIVE') {
console.log('Welcome , ' + res.login);
return;
}
});
}, function error(err) {
// handle errors as needed
console.error(err);
});
} else {
oktaSignIn.session.get(function (res) {
console.log("RESPONSES!", res)
if (res.status === 'ACTIVE') {
console.log('Response active!, ' + res);
// Also doesn't return name
return;
}
// No session, show the login form
oktaSignIn.renderEl({ el: '#okta-login-container' },
function success(res) {
// Nothing to do in this case, the widget will automatically redirect
// the user to Okta for authentication, then back to this page if successful
console.log("success", res)
},
function error(err) {
// handle errors as needed
console.error("error session", err);
}
);
});
}
This is the response
The _links array is not there.
How can I get the name & the avatar of the user?