Giter Site home page Giter Site logo

Comments (5)

arawden avatar arawden commented on May 18, 2024

I was unable to reproduce this issue this morning, so feel free to close this.

from go-jwt-middleware.

grounded042 avatar grounded042 commented on May 18, 2024

Hey @arawden. This sounds similar to #72. Any chance that issue gives any insight into the one you are having?

from go-jwt-middleware.

arawden avatar arawden commented on May 18, 2024

Hey @grounded042, it definitely looks to be equivalent.

To expand a little bit, I have an integration test which creates a token and then tries to make a request to an endpoint wrapped with the AuthedEndpoint middleware I posted. I've checked the token that gets passed to the endpoint in the jwt.io decoder, and it looks fine to me. It is the same token, roughly, as the one passed from my frontend, except it is missing the userinfo audience (I assume because the token is generated programatically), so there's only the string and no array.

With that said, I get similar behavior. If i catch the error on the token, err := jwt.ParseWithClaims(tokenString, &CustomClaims{}, func(token *jwt.Token) (interface{}, error), I get the error specified in the original bug report. As a result, when the ParseWithClaims call returns, the token struct's Valid field is set to false.

In total, both my integration tests and requests from my frontend to the endpoint wrapped with the middleware fail. In the first case, the token is considered not valid (if ok && token.Valid { fails, however the audience is fine because it is not an array), and in the second case, the CheckJWT call in the AuthedEndpoint middleware fails because the audience cannot be verified

I see there is a solution which involves converting the types in the call to VerifyAudience, however, I believe this solution would not work for me because I would need to implement a similar solution to the ParseWithClaims function.

I also see that @aaronprice00 posted a modified version of the go-jwt-middleware, however, given that my project is not dependent on authorization to move forward, I'm happy to wait for a more permanent solution.

Please let me know if you need any further information for this ticket, and I'll keep an eye on the issue you linked and try to contribute there if I can.

from go-jwt-middleware.

grounded042 avatar grounded042 commented on May 18, 2024

Thanks @arawden. I just dropped a comment over in #72 if you could take a look when you get a chance: #72 (comment)

from go-jwt-middleware.

sergiught avatar sergiught commented on May 18, 2024

We just released the v2.0.0-beta 🥳 !

You can start testing it by running go get github.com/auth0/go-jwt-middleware/[email protected].

In case of issues fetching the v2 you might want to try go clean --modcache first before doing go get.

I'm closing this issue as now this is part of v2, but feel free to reopen if needed.

from go-jwt-middleware.

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.