Skip to content

decide on expires_in vs. expires_at in @auth/core #6538

@benquan

Description

@benquan

Provider type

Google

Environment

System:
OS: macOS 13.0.1
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 44.64 MB / 8.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.4.0 - ~/.nvm/versions/node/v19.4.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v19.4.0/bin/yarn
npm: 9.2.0 - ~/.nvm/versions/node/v19.4.0/bin/npm
Browsers:
Chrome: 109.0.5414.119
Safari: 16.1

Reproduction URL

https://github.com/benquan/sveltekit-auth-example

Describe the issue

When using prisma adapter and Google provider in svelte-kit, google returns

Invalid `prisma.account.create()` invocation:

{
  data: {
    provider: 'google',
    type: 'oidc',
    providerAccountId: '115168544222660650939',
    access_token: 'ya29.a0AVvZVsp_2z3Vskexa91vre_Y3X_RcuTTts0sukQRQbAor7pRQyxe8PIiB-4Z8DQW39jXApnEqplbomHoOHs7j25u_tjvCBs1nLW-4X8GQ_gmA9ER-zmHOEUdA2y78U2LHO1VhdjIpLTHkTZDNj6DLR0QStYbaCgYKAfwSARESFQGbdwaIqk4fApUEYnTvKwbNJ4wJmA0163',
    expires_in: 3599,
    ~~~~~~~~~~
    scope: 'openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email',
    token_type: 'bearer',

...


Unknown arg `expires_in` in data.expires_in for type AccountUncheckedCreateInput. Did you mean `expires_at`? Available args:
type AccountUncheckedCreateInput {
  id?: String
  userId: String
  type: String
  provider: String
  providerAccountId: String
  refresh_token?: String | Null
  access_token?: String | Null
  expires_at?: Int | Null
  token_type?: String | Null
  scope?: String | Null
  id_token?: String | Null
  session_state?: String | Null
}




This causes an error when trying to record to the prisma adapter. For what I understand the adapter is expecting expires_at from google

This is mentioned in https://github.com/nextauthjs/next-auth/issues/6105 but the original issue was closed and not being followed up.

How to reproduce

clone from https://github.com/benquan/sveltekit-auth-example

create .env with:

AUTH_SECRET=xx
GOOGLE_ID=xx
GOOGLE_SECRET=xx
GITHUB_ID=xx
GITHUB_SECRET=xx
DATABASE_URL="file:./dev.db"

npm i
npm run dev

and try to sign in with google to reproduce the error.
If you sign in with github, it works fine.

The app is the sveltkit example plus prisma adapter and google provider.

Expected behavior

To sign in with no problem and store it with prisma.

Metadata

Metadata

Assignees

No one assigned

    Labels

    adaptersChanges related to the core code concerning database adaptersdocsRelates to documentationexperimental

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions