next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

(Some) users coming back from twitter have error=OAuthCreateAccount

Open georgiosd opened this issue 3 years ago • 4 comments

Question 💬

We designed a login page with Twitter OAuth login and we're having an issue with a minority of users that come back to the redirect and the URL params have error=OAuthCreateAccount.

I haven't been able to find any information on what this mean by Googling - has anyone else come across this case?

How to reproduce ☕️

We haven't been able to reproduce the issue, other than log it with Sentry.

Contributing 🙌🏽

No, I am afraid I cannot help regarding this

georgiosd avatar Jul 14 '22 05:07 georgiosd

This seems to be relevant: https://github.com/nextauthjs/next-auth/blob/cbf9622e6fc18e6cb344e1b0fae3e8e39bcf5aee/docs/versioned_docs/version-v3/configuration/pages.md#sign-in-page

So it seems the user creation failed with an error?

georgiosd avatar Jul 14 '22 06:07 georgiosd

Update: I added logger callbacks and captured errors - it looks like we're getting these four causes:

  1. CLIENT_FETCH_ERROR with "**non-serializable** (TypeError: Cannot read property 'constructor' of null)" - What is this? Using prisma adapter.

  2. Request token missing - what is this?

  3. local storage cant be accessed - anything we can do?

  4. Unique constraint failed while our only constraint in prisma is the one from the example: @@unique([provider, providerAccountId])

{
clientVersion: 4.0.0, 
code: P2002, 
message: Unique constraint failed on the (not available), 
meta: {
target: None
}, 
name: Error, 
stack: 
Error: Unique constraint failed on the (not available)
    at RequestHandler.handleRequestError (/var/task/node_modules/@prisma/client/runtime/index.js:49670:13)
    at RequestHandler.request (/var/task/node_modules/@prisma/client/runtime/index.js:49652:12)
    at async PrismaClient._request (/var/task/node_modules/@prisma/client/runtime/index.js:50572:18)
}

georgiosd avatar Jul 14 '22 09:07 georgiosd

Do you have browser information on these reports?

I think 1 and 3 are related. local storage cant be accessed sounds like either some old browser or something very strict is set on the browser, like this https://www.chromium.org/for-testers/bug-reporting-guidelines/uncaught-securityerror-failed-to-read-the-localstorage-property-from-window-access-is-denied-for-this-document/#:~:text=To%20find%20the%20setting%2C%20open,result%20in%20thrown%20SecurityError%20exceptions. :thinking:

For 2: https://stackoverflow.com/questions/55876669/twitter-oauth-access-token-error-request-token-missing

4 might be the result of the combination of the above. A user cannot be created or only created half (eg Account but not User or vice versa)

Either way, please attach a reproduction so we could verify, but at this point, it does not sound like we can do anything about this issue. You can see the Twitter login working fine here: https://next-auth-example.vercel.app/

balazsorban44 avatar Jul 14 '22 23:07 balazsorban44

It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!

stale[bot] avatar Sep 16 '22 00:09 stale[bot]

To keep things tidy, we are closing this issue for now. If you think your issue is still relevant, leave a comment and we might reopen it. Thanks!

stale[bot] avatar Sep 24 '22 03:09 stale[bot]