NextAuth V5 Beta - where do i put oAuth Credentials.
Answered
Plott Hound posted this in #help-forum
Plott HoundOP
I'm trying out nextauth V5 beta and struggling to figure out where i'd provide my GitHub credentials. I'm following this guide: https://authjs.dev/guides/upgrade-to-v5
- I have a .env file with
- In
- in
In V4 i'd typically i'd have something like this in my authOptions:
but i have no idea where i'm supposed to put this in V5
- I have a .env file with
GITHUB_ID and GITHUB_SECRET correctly setup.- In
app/api/auth/[...nextauth]/route.ts I have export { GET, POST } from "@/auth"- in
/auth.ts I have:import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
export const {
handlers: { GET, POST },
auth,
} = NextAuth({
providers: [GitHub],
})In V4 i'd typically i'd have something like this in my authOptions:
GitHubProvider({
clientId: process.env.GITHUB_ID ?? "",
clientSecret: process.env.GITHUB_SECRET ?? "",
}),but i have no idea where i'm supposed to put this in V5
Answered by Plott Hound
boy am i dumb:
import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
export const {
handlers: { GET, POST },
auth,
} = NextAuth({
providers: [
GitHub({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
})1 Reply
Plott HoundOP
boy am i dumb:
import NextAuth from "next-auth"
import GitHub from "next-auth/providers/github"
export const {
handlers: { GET, POST },
auth,
} = NextAuth({
providers: [
GitHub({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
],
})Answer