GithubHelp home page GithubHelp logo

JWT Token about passport-auth0 HOT 7 CLOSED

 avatar commented on May 9, 2024
JWT Token

from passport-auth0.

Comments (7)

KidkArolis avatar KidkArolis commented on May 9, 2024 3

Had to pass scope param to passport.authenticate:

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

from passport-auth0.

mikemimik avatar mikemimik commented on May 9, 2024 1

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

from passport-auth0.

 avatar commented on May 9, 2024
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

from passport-auth0.

 avatar commented on May 9, 2024

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

from passport-auth0.

mikemimik avatar mikemimik commented on May 9, 2024

@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.

from passport-auth0.

KidkArolis avatar KidkArolis commented on May 9, 2024

Having the same issue, docs are not accurate

from passport-auth0.

KidkArolis avatar KidkArolis commented on May 9, 2024

Looks like the docs are indeed incomplete?

from passport-auth0.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.