Unique id for each user in nextauth
Unanswered
kubas posted this in #help-forum
kubasOP
Hi! I'm making a website, I've added a working login system in next auth. When I do console.log(session.user) I get an object like this:
This is my code:
{"name":"example name","email":"example@example.com","image":"imageurl"}, I want this object had a unique id for each user. I am using github auth provider.This is my code:
// api/auth/[...nextauth]/route.ts
import NextAuth from "next-auth/next";
import {options} from "./options"
const handler = NextAuth(options)
export { handler as GET, handler as POST}// api/auth/[...nextauth]/options.ts
import type { NextAuthOptions } from 'next-auth'
import GitHubProvider from "next-auth/providers/github"
export const options: NextAuthOptions = {
providers: [
GitHubProvider({
clientId: process.env.GITHUB_ID as string,
clientSecret: process.env.GITHUB_SECRET as string,
}),
],
}