GithubHelp home page GithubHelp logo

Does not work with hapi-auth-jwt2 about grant HOT 6 CLOSED

simov avatar simov commented on April 28, 2024
Does not work with hapi-auth-jwt2

from grant.

Comments (6)

TBoonX avatar TBoonX commented on April 28, 2024 2

@Rub21
In your routes:

server.route({
        ..
        config: {
            ...
            auth: 'jwt'
        }
    });

in your server: (something like that)

server.auth.strategy('jwt', 'jwt', {
            key: SERIAL,
            validateFunc: validate,
            verifyOptions: {
                algorithms: [ALGORITHM],
                ignoreExpiration: true
            },
            headerKey: HEADER
        });

from grant.

simov avatar simov commented on April 28, 2024

How do you pass the config: {auth: false} to the Grant routes? I don't think that's currently possible.

from grant.

TBoonX avatar TBoonX commented on April 28, 2024
server.route({
    method: 'GET',
    path: '/handle_github_callback',
    handler: function(req, res) {
      //Continue with the token
      //Remark: third parameter have to be the name of the provider as listet for purest
      handlers.handleOAuth2Token(req, res, 'github');
    },
    config: {
      auth: false
    }
  });

this disables hapi-auth-jwt2 for the route.

from grant.

simov avatar simov commented on April 28, 2024

This options should be added to the Grant's internal /connect routes but that's currently not possible.

I don't see an option to filter out those routes in hapi-auth-jwt2 either, so I'm thinking about implementing a config object support for Grant.

from grant.

TBoonX avatar TBoonX commented on April 28, 2024

You are right!
I solved it for me with removing server.auth.default('jwt'); in my server.js and enabling jwt just for routes which needs it.
For me it is resolved but perhaps your proposal should be considered in the future.
Thanks

from grant.

Rub21 avatar Rub21 commented on April 28, 2024

hey @TBoonX ,

enabling jwt just for routes which needs it.

how did you enable for specific routes?

from grant.

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.