Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWT Token #30

Closed
ghost opened this issue Sep 6, 2016 · 7 comments · Fixed by #83
Closed

JWT Token #30

ghost opened this issue Sep 6, 2016 · 7 comments · Fixed by #83
Milestone

Comments

@ghost
Copy link

ghost commented Sep 6, 2016

In readme it's said that

extraParams.id_token has the JSON Web Token

but I can't figure it out. I need to take the JWT token of the user with profile but I can't figure out how to do it. Any help will be appreciated

@ghost
Copy link
Author

ghost commented Sep 6, 2016

var strategy = new Auth0Strategy({
    domain: process.env.AUTH0_DOMAIN,
    clientID: process.env.AUTH0_CLIENT_ID,
    clientSecret: process.env.AUTH0_CLIENT_SECRET,
    callbackURL: "/auth0callback"
},
    function (accessToken, refreshToken, extraParams, profile, done) {
        console.log(extraParams.id_token);
        return done(null, profile);
    });

Output: undefiend

@mikemimik
Copy link

@asharifi the id_token is only present when the responseType is set to code when sending the initial request to the api.

@ghost
Copy link
Author

ghost commented Sep 12, 2016

@mikemimik thanks for reply. So what should I change/add to my library to be able to get that in the function??

@mikemimik
Copy link

@asharifi in your application, I'm making the assumption that you have the user login on some route /login where they are presented with a login form/modal. Assuming again, on this page, you are using the lock library. Then in the options variable given to the constructor of Auth0Lock you would need to have something like the example below.

var lock = new Auth0Lock('{{clientID}}', '{{domain}}', {
  auth: {
    responseType: 'code',
    redirectUrl: '{{callbackUrl}}'
  }
});
lock.show();

Where {{clientID}} is the clientID of the application you're using with auth0 (eg: EDSHwerwk2l1kjf), {{domain}} is the tenant domain you're using with auth0 (eg: mycompany.auth0.com), and {{callbackUrl}} is a white listed callback url you have added to the client you're using on auth0 (eg: http://localhost:3000/callback)

In the above example I've also assumed that you're using a templating language that usings handlebars ({{, }}) to wrap view model variables.

@KidkArolis
Copy link

Having the same issue, docs are not accurate

@KidkArolis
Copy link

Had to pass scope param to passport.authenticate:

passport.authenticate('auth0', { scope: 'openid', failureRedirect: '/' }),

@KidkArolis
Copy link

Looks like the docs are indeed incomplete?

joshcanhelp added a commit that referenced this issue Jun 28, 2019
Add information on ID token scopes. 

Closes #30, #29
joshcanhelp added a commit that referenced this issue Jul 1, 2019
Add information on ID token scopes. 

Closes #30, #29
@joshcanhelp joshcanhelp added this to the v1.2.0 milestone Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants