-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
PKCE flow does not work #1530
Comments
please provide a full reproduction. we are using PKCE at work (not with Okta) without any problems |
without given my credentials it's impossible to you to reproduce, unless you have a okta account. |
Some kind of information must be given, or we are as helpless as you are. As mentioned, I cannot see this issue occurring on our end, so there must be something special with your usecase/config. Providing more information is the key to resolve the problem. We could start by looking at your #1367, #952 etc. might be similar if your problem happens on Safari. Looks like people have problems with those especially. |
I using last stable version or all libs:
For [...nextauth].js I followed the default config. import NextAuth from "next-auth";
import Providers from "next-auth/providers";
export default NextAuth({
providers: [
Providers.Okta({
clientId: "xxxxxxxx",
domain: "xxxxxx.oktapreview.com/oauth2/xxxxxxxxxxx",
protection: "pkce",
}),
],
}); protection: "pkce" stops sending the Tried passing response_type on params object and also direct on the authorizationUrl,
I'm testing on a macos, chrome browser, does not to seems to be an issue |
As far as I can tell, authorization code with PKCE is what Okta also expects and recommends https://developer.okta.com/blog/2019/08/22/okta-authjs-pkce nonce and state are (according to my understanding) not part of the PKCE flow, so they shouldn't be causing a problem here, I think. Here is the specs for how we implement PKCE https://tools.ietf.org/html/rfc7636#section-4 Could you also provide the errors you are getting? Both from next-auth and Okta? |
When using the without using the custom provider the params expected for okta with PKCE are the follow: Nextjs console gives me:
adding
gives me :
But, again, this next-auth erros, does not match the response from okta. I do remember seeing the same params for Azure B2C. |
Thanks 👍, you provided plenty of information now, I hope this will help to debug this issue. |
I think we should be looking at this doc: https://tools.ietf.org/html/rfc6749 |
I've a suggestion to fix it: |
This has now been merged, and |
@viniciuscr is this resolved |
Describe the bug
Using provider with specify PKCE auth flow does not work.
A provider such Okta expects a PKCE flow to work, this flow expect the follow params:
Using the
protection: "pkce"
config, does not seems to work, it also removes the paramstate
.I tried to create a custom provider, but I could not find any logic where the nonce param is set.
Steps to reproduce
I've used the Okta provider and tried with and without the
protection: "pkce"
.Expected behavior
protection: "pkce" should have the follow changes:
state
paramnonce
paramresponse_type
changed to id_token token coderesponse_mode
= fragmentScreenshots or error logs
Error provided on next console does not match the errors returned by the okta api.
The real erros from the api would be complaining about missing params.
Feedback
there is a great doc about PKCE with okta here:
https://developer.okta.com/blog/2019/08/22/okta-authjs-pkce
The text was updated successfully, but these errors were encountered: