-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
153b230
commit 7ff9a8c
Showing
2 changed files
with
16 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ import { | |
type NextAuthOptions, | ||
} from "next-auth"; | ||
import GoogleProvider from "next-auth/providers/google"; | ||
import CredentialsProvider from "next-auth/providers/credentials"; | ||
|
||
import { env } from "~/env"; | ||
import { db } from "~/server/db"; | ||
|
@@ -30,53 +29,6 @@ declare module "next-auth" { | |
// // role: UserRole; | ||
// } | ||
} | ||
|
||
/** | ||
* Provider to be used in a production environment. | ||
*/ | ||
const productionProviders = [ | ||
GoogleProvider({ | ||
clientId: env.GOOGLE_CLIENT_ID ?? "", | ||
clientSecret: env.GOOGLE_CLIENT_SECRET ?? "", | ||
}), | ||
/** | ||
* ...add more providers here. | ||
* | ||
* Most other providers require a bit more work than the Discord provider. For example, the | ||
* GitHub provider requires you to add the `refresh_token_expires_in` field to the Account | ||
* model. Refer to the NextAuth.js docs for the provider you want to use. Example: | ||
* | ||
* @see https://next-auth.js.org/providers/github | ||
*/ | ||
]; | ||
|
||
/** | ||
* Provider to be used in a Vercel Preview | ||
*/ | ||
const previewProvider = [ | ||
CredentialsProvider({ | ||
name: "TEST USER", | ||
id: "cooper-test-provider", | ||
async authorize() { | ||
return { | ||
id: "1", | ||
name: "Cooper Test User", | ||
email: "[email protected]", | ||
image: "https://i.pravatar.cc/[email protected]", | ||
}; | ||
}, | ||
credentials: {}, | ||
}), | ||
]; | ||
|
||
const getProvider = () => { | ||
if (process.env.VERCEL_ENV === "preview") { | ||
return previewProvider; | ||
} else { | ||
return productionProviders; | ||
} | ||
}; | ||
|
||
/** | ||
* Options for NextAuth.js used to configure adapters, providers, callbacks, etc. | ||
* | ||
|
@@ -93,7 +45,21 @@ export const authOptions: NextAuthOptions = { | |
}), | ||
}, | ||
adapter: PrismaAdapter(db), | ||
providers: getProvider(), | ||
providers: [ | ||
GoogleProvider({ | ||
clientId: env.GOOGLE_CLIENT_ID ?? "", | ||
clientSecret: env.GOOGLE_CLIENT_SECRET ?? "", | ||
}), | ||
/** | ||
* ...add more providers here. | ||
* | ||
* Most other providers require a bit more work than the Discord provider. For example, the | ||
* GitHub provider requires you to add the `refresh_token_expires_in` field to the Account | ||
* model. Refer to the NextAuth.js docs for the provider you want to use. Example: | ||
* | ||
* @see https://next-auth.js.org/providers/github | ||
*/ | ||
], | ||
}; | ||
|
||
/** | ||
|