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.Keyfunc #92

Closed
jiangjiali opened this issue Jun 5, 2021 · 7 comments
Closed

jwt.Keyfunc #92

jiangjiali opened this issue Jun 5, 2021 · 7 comments

Comments

@jiangjiali
Copy link

无法将 'func(*jwt.Token) (interface{}, error) { return []byte(configure.Config.GetString("jwt.secret")), nil }' (类型 func(*jwt.Token) (interface{}, error)) 用作类型 jwt.Keyfunc

@DeamonMV
Copy link

DeamonMV commented Jun 5, 2021

@jiangjiali
try this hack - change in your go.mod version of the go-jwt-middleware

from github.com/auth0/go-jwt-middleware v1.0.0
to github.com/auth0/go-jwt-middleware v0.0.0-20190805220309-36081240882b

@DeamonMV
Copy link

DeamonMV commented Jun 5, 2021

I'll elaborate little bit more about this problem.

I have spend whole day to understand why I cannot use my func in the ValidationKeyGetter. That is how it looks:
image

At the end of the day I came up with idea to check version of the go-jwt-middleware module, and I have noticed that in the example repository https://github.com/auth0-blog/go-react-vr/blob/master/go.mod version is v0.0.0, and all works fine

But when I have create a go project from scratch, version was used v1.0.0, with which was a problem.

Can please someone help with this?
Thanks

@DeamonMV
Copy link

DeamonMV commented Jun 5, 2021

@jiangjiali if you please set this title for the issue

Version v1.0.0 have issue on custom jwt.Keyfunc for ValidationKeyGetter

I think this will expand more information about problem for other people. Thank you.

@jiangjiali
Copy link
Author

Take the author to update the bug.
Thank you for taking the time to answer this less important question.

@grounded042
Copy link
Contributor

The reason for this is when you upgrade to v1.0.0 you need to use github.com/form3tech-oss/jwt-go instead of github.com/dgrijalva/jwt-go. Context of this switch can be found here: #69 (comment)

This project was not properly handling go module versioning which is why we had a breaking change like this. We will soon be releasing a v2 of the package which should handle things much better.

@grounded042
Copy link
Contributor

@jiangjiali with the above comment is this still and issue you are hitting?

@jiangjiali
Copy link
Author

Now there is no problem.
I fully understand.

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

No branches or pull requests

3 participants