-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
adaptersChanges related to the core code concerning database adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingSomething isn't working
Description
Describe the bug
I believe I uncovered a bug related to OAuth 2 handling in v3.2.0-canary.41. In #1211 the expires_in value (expressed as number of seconds from the current time, per the OAuth spec) is now passed in to accessTokenExpires rather than simply remaining null. However, account.access_token_expires is declared as a timestamp in the schema. Using the Prisma adapter with PostgreSQL, this leads to an error when logging in. I'm using Auth0 as my provider, but this should be an issue with any OAuth provider.
Steps to reproduce
- Setup Next-Auth backed by a relational database (e.g. PostgreSQL)
- Upgrade to v3.2.0-canary.41
- Attempt to log in with a new account not yet present in the database.
Sorry, no public repo with repro at this time.
Expected behavior
I expect the login to be successful.
Screenshots or error logs
[next-auth][debug][prisma_link_account] 2 auth0 oauth auth0|REMOVED undefined REMOVED 86400
[next-auth][error][oauth_callback_handler_error]
https://next-auth.js.org/errors#oauth_callback_handler_error PrismaClientValidationError:
Invalid `prisma.account.create()` invocation:
{
data: {
accessToken: 'REMOVED',
refreshToken: undefined,
compoundId: 'REMOVED',
providerAccountId: 'auth0|REMOVED',
providerId: 'auth0',
providerType: 'oauth',
accessTokenExpires: 86400,
~~~~~
userId: 2
}
}
Argument accessTokenExpires: Got invalid value 86400 on prisma.createOneAccount. Provided Int, expected DateTime or Null.
Additional context
none
balazsorban44
Metadata
Metadata
Assignees
Labels
adaptersChanges related to the core code concerning database adaptersChanges related to the core code concerning database adaptersbugSomething isn't workingSomething isn't working