Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ar(random) oauth #4

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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
Loading