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 #13

Merged
merged 4 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 @@ -18,6 +18,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
30 changes: 16 additions & 14 deletions lib/auth/constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// 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 @@ -16,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 @@ -62,6 +64,6 @@ export const authOptions: AuthOptions = {
signOut: '/',
error: '/error', // Error code passed in query string as ?error=
verifyRequest: '/verify', // (used for check email message)
// newUser: '/' // New users will be directed here on first sign in (leave the property out if not of interest)
newUser: '/services/rickmorty', // New users will be directed here on first sign in (leave the property out if not of interest)
},
};
Loading