Add GitHub provider
This commit is contained in:
@@ -2,6 +2,7 @@ import NextAuth from 'next-auth'
|
||||
import CredentialsProvider from 'next-auth/providers/credentials'
|
||||
import TwitterProvider from 'next-auth/providers/twitter'
|
||||
import GoogleProvider from 'next-auth/providers/google'
|
||||
import GitHubProvider from 'next-auth/providers/github'
|
||||
import axios from 'axios'
|
||||
|
||||
const options = {
|
||||
@@ -36,6 +37,10 @@ const options = {
|
||||
GoogleProvider({
|
||||
clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
|
||||
clientSecret: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_SECRET
|
||||
}),
|
||||
GitHubProvider({
|
||||
clientId: process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID,
|
||||
clientSecret: process.env.NEXT_PUBLIC_GITHUB_CLIENT_SECRET
|
||||
})
|
||||
],
|
||||
secret: process.env.NEXT_PUBLIC_JWT_SECRET,
|
||||
@@ -51,7 +56,7 @@ const options = {
|
||||
url = `${process.env.NEXT_PUBLIC_API_URL}/auth/${account.provider}/callback?access_token=${account?.oauth_token}&access_secret=${account?.oauth_token_secret}`
|
||||
}
|
||||
|
||||
if (account.provider === 'google') {
|
||||
if (account.provider === 'google' || account.provider === 'github') {
|
||||
url = `${process.env.NEXT_PUBLIC_API_URL}/auth/${account.provider}/callback?access_token=${account?.access_token}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user