okta / okta-auth-js

The official js wrapper around Okta's auth API
Other
446 stars 257 forks source link

Getting 400 bad request pkce verification failed using okta sign in widget react #1527

Open pream1234 opened 1 month ago

pream1234 commented 1 month ago

Describe the bug

I'm having issue with generating access tokens for users during the login process. While trying to login, request to https:///oauth2//token is sent. Sometimes it results in 400 Bad Request

Reproduction Steps?

Whenever we open new incognito tab for first time we are getting this issue . After refresh it works fine

SDK Versions

Okta-signin widget 7.20.1 Okta-authjs:7.7.0

Additional Information?

No response

jaredperreault-okta commented 1 month ago

Tokens cannot be issued until a user has successfully authenticated.

Can you please elaborate on this comment

generating access tokens for users during the login process

Secondly, can you please provide code snippets or a sample repo?

pream1234 commented 1 month ago

@jaredperreault-okta Thanks for the quick response .basically we are having react spa where we are using okta sign-in widget using interaction code flow . Once the user enter username and password on click of sign-in I’m getting “oautherror:pkce verification failed “ IMG_1174

pream1234 commented 1 month ago

On click of refresh it login is successfully

jaredperreault-okta commented 1 month ago

Secondly, can you please provide code snippets or a sample repo?

pream1234 commented 1 month ago

@jaredperreault-okta Attaching Coding snippets which we are using image image image

jaredperreault-okta commented 1 month ago

Is your onSuccess handler firing? If so, what is the value of tokens?

Optionally you could try showSignIn, rather than showSignInToGetTokens