user3041713
user3041713

Reputation: 21

next-auth only valid absolute URLs can be requested

I updated [email protected] to [email protected] for okta signin(reactjs). After that I am getting the following errors:

[next-auth][error][SIGNIN_OAUTH_ERROR] https://next-auth.js.org/errors#signin_oauth_error only valid absolute URLs can be requested

Please anyone help me get out of this.

Upvotes: 2

Views: 8155

Answers (4)

Tamas Illes
Tamas Illes

Reputation: 199

Make sure that your okta issuer looks like this:

https://{your_okta_domain}.okta.com/oauth2/default

Also if you are using it in localhost, in your .env file make sure that you store this variable without enclosing it in "". So instead of storing the value as:

OKTA_ISSUER = "my_okta_issuer"

use instead:

OKTA_ISSUER = my_okta_issuer

It took me a day to figure that out, but now it works.

Upvotes: 1

Catherine Healey
Catherine Healey

Reputation: 41

Another difference... the domain has to include https://

Upvotes: 4

brunocoelho
brunocoelho

Reputation: 338

Make sure that after you upgrade from next-auth v3 to v4, you also update the config object you're passing to OktaProvider.

The problem with me is that I was still using domain while the new API was expecting issuer.

v3:

OktaProvider({
  clientId: data.REACT_APP_OKTA_CLIENTID,
  clientSecret: data.REACT_APP_OKTA_CLIENTSECRET,
  domain: data.REACT_APP_OKTA_DOMAIN, // <<<<<<<<<< before
}),

v4:

OktaProvider({
  clientId: data.REACT_APP_OKTA_CLIENTID,
  clientSecret: data.REACT_APP_OKTA_CLIENTSECRET,
  issuer: data.REACT_APP_OKTA_DOMAIN, // <<<<<<<<<< after
}),

Upvotes: 3

Laurenz Honauer
Laurenz Honauer

Reputation: 344

Most probably you missed a step when upgrading, I suggest you (re-)visit the update guide

The description you provided is very minimal, making it hard to give you a valuable answer. If you share your codebase somehow, either via GitHub, a sandbox, or a minimal reproducible example, the community can help you better

Upvotes: 0

Related Questions