Skip to content

Issues with Github and Google login #3

Description

@nigellima

Hi, thanks a lot for the tutorial

I tried to follow the part where you teach how to integrate Next Auth with Github and Google providers.

I have the same schema in my prisma.schema for the Accout:

model Account {
  id String @id @default(auto()) @map("_id") @db.ObjectId
  userId             String   @db.ObjectId
  type               String
  provider           String
  providerAccountId  String
  refresh_token      String?  @db.String
  access_token       String?  @db.String
  expires_at         Int?
  token_type         String?
  scope              String?
  id_token           String?  @db.String
  session_state      String?
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
  @@unique([provider, providerAccountId])
}

And here it's my NextAuth options config:

image

For the Github sign in, it's throwing this error:

19 linkAccount: (data) => p.account.create({
       data: {
         provider: 'github',
         type: 'oauth',
         providerAccountId: '<ID>',
         access_token: '<TOKENN>,
         token_type: 'bearer',
         scope: 'read:user,user:email',
         ~~~~~
         userId: '<ID>'
       }
     })

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

And as for Google, it throws a similar error but with another field:

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

{
  data: {
    provider: 'google',
    type: 'oauth',
    providerAccountId: '<ID>',
    access_token: '<TOKEN>',
    expires_at: 1678684284,
    ~~~~~~~~~~
    token_type: 'Bearer',
    id_token: '<TOKEN>',
    userId: '<ID>'
  }
}

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

Am I missing something?
Thanks in advance for the help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions