Skip to content

Commit

Permalink
ar(random) oauth (#13)
Browse files Browse the repository at this point in the history
* ar(random) oauth

* ar(random) oauth

* ar(random) oauth

* ar(random) oauth
  • Loading branch information
angeloreale authored Jul 12, 2024
1 parent b2aa8fd commit 515685c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
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)
},
};

0 comments on commit 515685c

Please sign in to comment.