-
Notifications
You must be signed in to change notification settings - Fork 927
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
Add audience to Auth0 request. Fixes #176. #222
Conversation
With these fixes, Auth0 login now works. Thank you!!!~ |
Sorry for late merge. And thanks for this fix. Changes will be published soon. |
This is wrong. Audience is your backend API server's name in Auth0, not your Auth0 domain. This simply fails with "Service not found" callback error. |
|
@kazazes But using the Auth0 domain as audience makes no sense. It's the domain of your API server. |
@ishitatsuyuki This sets the audience parameter of the oAuth strategy. |
@kazazes That does not answer the question. You broke all the things:
|
Audience is a JWT property, not Auth0. The Auth0 provider uses the OAuth scheme to request a token. You’re right in that it ideally shouldn’t be a property of all OAuth requests, but the library was entirely broken for Auth0 without it before. Does this break another OAuth flow? Can you provide an example? |
I used Auth0's "default audience" setting to make it work before. Now you supply an invalid audience that I can't even change. |
Edit: I had to look at my PR, it's been a few months. On second glance @ishitatsuyuki, it is just assigning a default audience to preserve backwards compatibility. Specify your desired audience in your config. If that's not working, can you please post a sample?
|
OK, now I see that I can override the default. However, that's not really a sane default, but rather broken by default. You should just leave it undefined to preserve former behaviour. |
@ishitatsuyuki Auth0 will not provide a token without an audience for OIDC-conformant APIs. See #176. |
@kazazes I'm not sure if I remember correctly, but I think Auth0 will return an opaque token if audience is not provided. Anyway, your default is wrong:
|
But we do want to access a custom API. IIRC the default worked for me and other users in #176. I don't have a project to test with anymore, but based on your experience audience should now be a required value, with no default. Is your Auth0 app OIDC compliant? That may be the difference. New applications are by default, I believe. |
Yes, it is OIDC compliant. Not supplying the audience should work as the default: I think it's how the Nuxt Auth example worked before. |
Yes, it did work before but will not work now. The doc example app would fail on a newly created Auth0 app, before this PR and now, if an audience is not provided. As of June 8th, the The default should be removed entirely and the audience should be a more highlighted configuration option. Without a default audience set on the tenant, passing none will fail. |
@ishitatsuyuki, thanks for pointing this out. Should be mitigated in #239. Could you please test? I don't have a project currently using the module. |
This PR has been published in v4.6.0 |
Allows and defaults to adding audience field to Auth0 requests in order to return a JWT. Fixes #176.