Skip to content
This repository has been archived by the owner on Oct 8, 2023. It is now read-only.

Sign in does not work with any provider #314

Open
dastanr opened this issue Apr 24, 2023 · 5 comments
Open

Sign in does not work with any provider #314

dastanr opened this issue Apr 24, 2023 · 5 comments

Comments

@dastanr
Copy link

dastanr commented Apr 24, 2023

I am using latest version of keystone and keystone-nextjs-auth package and when I click on sign in button the page refreshes and nothing else happens:

Here are more details
Screenshot 2023-04-24 at 5 46 03 PM

Keystone Package versions

"@graphql-tools/schema": "^9.0.17",
"@keystone-6/auth": "^7.0.0",
"@keystone-6/core": "^5.1.0",
"@keystone-6/fields-document": "^7.0.0",
"@keystone-ui/core": "^5.0.2",

This is what I get in terminal

[next-auth][error][CLIENT_FETCH_ERROR] 
https://next-auth.js.org/errors#client_fetch_error undefined {
  error: {},
  url: 'http://localhost:3000/admin/api/auth/session',
  message: undefined
}

here is my .env content

NEXTAUTH_URL=http://localhost:3000/admin/api/auth
SESSION_SECRET="H0Rvwx5gy5elNS2VhUuQfo5+5sL9WWJQ8dbIR/YsMs0="
DATABASE_URL=postgres://test:test@localhost:5432/test

Any ideas? any help is appreciated.

@dungnn1711
Copy link

Same issue.
I try to resolve it, but it can't work correctly.
Anyone else helps?

@borisno2
Copy link
Member

This error will generally happen when Next-Auth can't find the NEXTAUTH_URL. Make sure the environment variable is set correctly - if using dotenv you could try setting the environment variable directly on the CLI.

If you have a minimal replication steps or code where you get the error I am happy to have a look.

@dungnn1711
Copy link

I already set NEXTAUTH_URL="http://localhost:3000"
but it still does not work

in my case, I just initiated a new project by create-keystone-app CLI and then add keystone-nextjs-auth to try to integrate my application with Okta

@borisno2
Copy link
Member

I have been doing some troubleshooting this issue, and it looks like a change that happened in the next-auth getSession() API between 4.19.1 and 4.22.1 to resolve for now you can use resolutions in your package.json to pin to [email protected]

@dungnn1711
Copy link

Thank you, bro!
It's correct, I resolved this issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants