mirror of
https://github.com/System-End/site.git
synced 2026-04-20 00:25:19 +00:00
auth
This commit is contained in:
parent
5f99895da6
commit
93a963933b
1 changed files with 26 additions and 0 deletions
26
pages/api/auth/[...nextauth].js
Normal file
26
pages/api/auth/[...nextauth].js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import NextAuth from "next-auth"
|
||||
import GithubProvider from "next-auth/providers/github";
|
||||
|
||||
const CLIENT_ID = process.env.CLIENT_ID
|
||||
const CLIENT_SECRET = process.env.CLIENT_SECRET
|
||||
|
||||
export default NextAuth({
|
||||
providers: [
|
||||
GithubProvider({
|
||||
clientId: CLIENT_ID,
|
||||
clientSecret: CLIENT_SECRET,
|
||||
authorization: { params: { scope: "read:user user:email" } },
|
||||
profile(profile) {
|
||||
return {
|
||||
name: profile.login,
|
||||
email: profile.email,
|
||||
image: profile.avatar_url,
|
||||
id: profile.id.toString(),
|
||||
githubId: profile.id.toString(),
|
||||
githubUsername: profile.login,
|
||||
};
|
||||
},
|
||||
}),
|
||||
],
|
||||
secret: process.env.NEXTAUTH_SECRET,
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue