Auth0 JWT as access token comes in only on second login -
i have issue , i'm not sure whether "bug" or fault somewhere.
all of sap on asp.net core angular accessing auth0 on hosted page.
i have updated hosted page auth0lock object on hosted page inculde params object specified audience
var lock = new auth0lock(config.clientid, config.auth0domain, { auth: { redirecturl: config.callbackurl, responsetype: 'token', params: { "audience": "https://api.webatom.com" } }, assetsurl: config.assetsurl, allowedconnections: connection ? [connection] : null, rememberlastlogin: !prompt, language: language, languagedictionary: languagedictionary, theme: { //logo: 'your logo here', //primarycolor: 'green' }, prefill: loginhint ? { email: loginhint, username: loginhint } : null, closable: false, // uncomment if want small buttons social providers // socialbuttonstyle: 'small' });
during first login usual auth result receive jwt id_token , short string access token , don't message in auth0 account access request.
during second , other logins want. message , jwt access token , id_token null.
how second result start, right first login? bug or doing wrong?
thank you.
ps: don't have rules or hooks implemented @ moment.
as first step: add https://jwt.io
allowed callback client, revert auth0 hosted login page default (ie. remove changes made), modify url below own settings, , paste browser url , hit return.
https://{{your_tenant}}.auth0.com/login?client={{your_client_id}}&redirecturl=https://jwt.io&responsetype=token&connection={{your_connection_name}}&audience=https://api.webatom.com&scope=openid
all going well, should return jwt access token , auto-populate jwt.io text-area.
next, try - using auth0's authorize url instead. again, use auth0 default hosted login page, not 1 modified.
https://{{your_tenant}}.auth0.com/authorize?client_id={{your_client_id}}&protocol=oauth2&redirect_uri=https://jwt.io&response_type=token&scope=openid profile&audience=https://api.webatom.com&nonce=123&state=xyz
should same result. , presumably want every time?
if want id token, modify responsetype / response_type token id_token
.
so recommend not modify auth0 hosted login page settings lock directly (authentication related params..), instead send through parameters want request per /authorize
endpoint above. if have client application using auth0.js
example, can set @ client , send through when user authenticates.
sample snippet auth0.js
library config might be:
auth0 = new auth0.webauth({ domain: auth_config.domain, clientid: auth_config.clientid, redirecturi: auth_config.callbackurl, audience: "https://webapi.com", responsetype: 'token id_token', // use token if don't need id token scope: 'openid profile read:book' // read:book scope defined api });
Comments
Post a Comment