Coder Social home page Coder Social logo

Comments (5)

bjornol avatar bjornol commented on August 21, 2024 1

Same issue here on versions

"express": "^4.18.1",
"express-jwt": "^7.7.5",
"express-jwt-authz": "^2.4.1"

Solution from afilazzola works.

The problem is caused by the express-jwt v6 upgrade where the decoded JWT payload is now available as req.auth rather than req.user. See migration points (Migration from v6) in the express-jwt description. https://github.com/auth0/express-jwt

from express-jwt-authz.

henryspivey avatar henryspivey commented on August 21, 2024

I'm getting the same error, "Insufficient Scope" as mentioned above
I am running:
"express": "^4.18.1",
"express-jwt": "^7.7.5",
"express-jwt-authz": "^2.4.1",

As suggested above, doing let userKey = 'auth' fixed the issue.

from express-jwt-authz.

luisr-carrillo avatar luisr-carrillo commented on August 21, 2024

As you commented, customUserKey: 'auth' fixed the issue.

But I have to change my Auth0 API settings, on the API dashboard then 'RBAC Settings' I actived 'Enable RBAC' and 'Add Permissions in the Access Token'.

This is my final config.
export const checkPermissions = (permissions: string[]) => { return jwtAuthz(permissions, { customScopeKey: 'permissions', customUserKey: 'auth' }); };

from express-jwt-authz.

danielwagn3r avatar danielwagn3r commented on August 21, 2024

I've noticed this error as well. However in my case, I didn't use any additional properties in the JWT for RBAC or other stuff, I just used the standard scope parameter to check for client permissions (in my case it's a m2m use-case).

Didn't get it working with this package and therefore looked at https://github.com/benrei/express-jwt-scope

Used this versions:
"express": "^4.18.1",
"express-jwt": "^7.7.5",
"express-jwt-authz": "^2.4.1",

from express-jwt-authz.

FSou1 avatar FSou1 commented on August 21, 2024

Same.

Make sure you use express-jwt, because express-jwt-authz depends on that package under the hood.

from express-jwt-authz.

Related Issues (18)

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.