Next.js Discord

Discord Forum

NextJS auth question

Unanswered
Mugger Crocodile posted this in #help-forum
Open in Discord
Mugger CrocodileOP
Hiya,

I've recently been adding auth to my app, and now on the stage of adding oath. Because I was looking for a bit of a challenge, I decided to implement it myself with no AI, just raw oauth documentation and my own interpretation. So far its going really well however I've gotten to the point where I need to save the oauth data in my db. BUT, upon looking at the next-auth schema recommendation, I have no idea what some of the fields are meant to hold (i will mark with an *). if anyone can assist in explaining them to me, I would be more than grateful. Thanks.

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

0 Replies