fix docker build
This commit is contained in:
@@ -44,44 +44,48 @@ declare module "next-auth" {
|
||||
* Auth providers
|
||||
*/
|
||||
|
||||
const providers: Provider[] = [];
|
||||
function getProviders() {
|
||||
const providers: Provider[] = [];
|
||||
|
||||
if (env.GITHUB_ID && env.GITHUB_SECRET) {
|
||||
providers.push(
|
||||
GitHubProvider({
|
||||
clientId: env.GITHUB_ID,
|
||||
clientSecret: env.GITHUB_SECRET,
|
||||
allowDangerousEmailAccountLinking: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
if (env.GITHUB_ID && env.GITHUB_SECRET) {
|
||||
providers.push(
|
||||
GitHubProvider({
|
||||
clientId: env.GITHUB_ID,
|
||||
clientSecret: env.GITHUB_SECRET,
|
||||
allowDangerousEmailAccountLinking: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (env.GOOGLE_CLIENT_ID && env.GOOGLE_CLIENT_SECRET) {
|
||||
providers.push(
|
||||
GoogleProvider({
|
||||
clientId: env.GOOGLE_CLIENT_ID,
|
||||
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
||||
allowDangerousEmailAccountLinking: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
if (env.GOOGLE_CLIENT_ID && env.GOOGLE_CLIENT_SECRET) {
|
||||
providers.push(
|
||||
GoogleProvider({
|
||||
clientId: env.GOOGLE_CLIENT_ID,
|
||||
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
||||
allowDangerousEmailAccountLinking: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (env.FROM_EMAIL) {
|
||||
providers.push(
|
||||
EmailProvider({
|
||||
from: env.FROM_EMAIL,
|
||||
async sendVerificationRequest({ identifier: email, url, token }) {
|
||||
await sendSignUpEmail(email, token, url);
|
||||
},
|
||||
async generateVerificationToken() {
|
||||
return Math.random().toString(36).substring(2, 7).toLowerCase();
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
if (env.FROM_EMAIL) {
|
||||
providers.push(
|
||||
EmailProvider({
|
||||
from: env.FROM_EMAIL,
|
||||
async sendVerificationRequest({ identifier: email, url, token }) {
|
||||
await sendSignUpEmail(email, token, url);
|
||||
},
|
||||
async generateVerificationToken() {
|
||||
return Math.random().toString(36).substring(2, 7).toLowerCase();
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (providers.length === 0) {
|
||||
throw new Error("No auth providers found, need atleast one");
|
||||
if (providers.length === 0 && process.env.SKIP_ENV_VALIDATION !== "true") {
|
||||
throw new Error("No auth providers found, need atleast one");
|
||||
}
|
||||
|
||||
return providers;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +120,7 @@ export const authOptions: NextAuthOptions = {
|
||||
}
|
||||
},
|
||||
},
|
||||
providers,
|
||||
providers: getProviders(),
|
||||
};
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user