Skip to content

Commit

Permalink
Merge pull request #4 from dreampipcom/ar/random/oauth
Browse files Browse the repository at this point in the history
ar(random) oauth
  • Loading branch information
angeloreale authored Jul 12, 2024
2 parents 64ca73e + 4d5c672 commit 5a422c7
Show file tree
Hide file tree
Showing 5 changed files with 244 additions and 231 deletions.
4 changes: 4 additions & 0 deletions .env.public
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ GITHUB_ID=
GITHUB_SECRET=
INSTAGRAM_CLIENT_ID=
INSTAGRAM_CLIENT_SECRET=
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=
APPLE_CLIENT_ID=
APPLE_CLIENT_SECRET=

# env agnostic/specific: depends on your setup
EMAIL_SERVER=
Expand Down
4 changes: 2 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
npm run format:fix
npm run build
#npm run format:fix
#npm run build
40 changes: 26 additions & 14 deletions lib/auth/constants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* eslint no-unreachable:0 */
// constants.ts TS-Doc?
import type { AuthOptions } from 'next-auth';
import GithubProvider from 'next-auth/providers/github';
// import GoogleProvider from 'next-auth/providers/google';
import AppleProvider from 'next-auth/providers/apple';
import FacebookProvider from 'next-auth/providers/facebook';
import EmailProvider from 'next-auth/providers/email';
import InstagramProvider from 'next-auth/providers/instagram';
// import InstagramProvider from 'next-auth/providers/instagram';

export const authOptions: AuthOptions = {
// Configure one or more authentication providers
providers: [
EmailProvider({
server: process.env.EMAIL_SERVER as string,
Expand All @@ -17,17 +18,17 @@ export const authOptions: AuthOptions = {
clientId: process.env.GITHUB_ID as string,
clientSecret: process.env.GITHUB_SECRET as string,
}),
InstagramProvider({
clientId: process.env.INSTAGRAM_CLIENT_ID,
clientSecret: process.env.INSTAGRAM_CLIENT_SECRET,
async profile(profile: any) {
return {
id: profile.id,
name: profile.username,
email: profile.username + '@insta.local',
image: null,
};
},
// GoogleProvider({
// clientId: process.env.GOOGLE_CLIENT_ID as string,
// clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
// }),
AppleProvider({
clientId: process.env.APPLE_CLIENT_ID as string,
clientSecret: process.env.APPLE_CLIENT_SECRET as string,
}),
FacebookProvider({
clientId: process.env.FACEBOOK_CLIENT_ID as string,
clientSecret: process.env.FACEBOOK_CLIENT_SECRET as string,
}),
// ...add more providers here
],
Expand Down Expand Up @@ -58,6 +59,17 @@ export const authOptions: AuthOptions = {
return session;
},
},
cookies: {
pkceCodeVerifier: {
name: 'next-auth.pkce.code_verifier',
options: {
httpOnly: true,
sameSite: 'none',
path: '/',
secure: true,
},
},
},
pages: {
signIn: '/signin',
signOut: '/',
Expand Down
Loading

0 comments on commit 5a422c7

Please sign in to comment.