created debug credentials provider

This commit is contained in:
Yannic Kilcher
2022-12-26 16:13:43 +01:00
parent f8c3008003
commit 5125e84055
8 changed files with 64 additions and 5 deletions
@@ -2,8 +2,10 @@ import type { AuthOptions } from "next-auth";
import NextAuth from "next-auth";
import DiscordProvider from "next-auth/providers/discord";
import EmailProvider from "next-auth/providers/email";
import CredentialsProvider from "next-auth/providers/credentials";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import { boolean } from "boolean";
import prisma from "src/lib/prismadb";
const providers = [];
@@ -32,6 +34,23 @@ if (process.env.DISCORD_CLIENT_ID) {
);
}
if (boolean(process.env.DEBUG_FAKE_USERS)) {
providers.push(
CredentialsProvider({
name: "Debug Credentials",
credentials: {
username: { label: "Username", type: "text" },
},
async authorize(credentials) {
return {
id: credentials.username,
name: credentials.username,
};
},
})
);
}
export const authOptions: AuthOptions = {
// Ensure we can store user data in a database.
adapter: PrismaAdapter(prisma),