mirror of
https://github.com/documenso/documenso.git
synced 2025-11-15 09:12:02 +10:00
fix: add oidc env variables
This commit is contained in:
@ -8,6 +8,7 @@ export type OAuthClientOptions = {
|
||||
clientSecret: string;
|
||||
wellKnownUrl: string;
|
||||
redirectUrl: string;
|
||||
bypassEmailVerification?: boolean;
|
||||
};
|
||||
|
||||
export const GoogleAuthOptions: OAuthClientOptions = {
|
||||
@ -17,6 +18,7 @@ export const GoogleAuthOptions: OAuthClientOptions = {
|
||||
clientSecret: env('NEXT_PRIVATE_GOOGLE_CLIENT_SECRET') ?? '',
|
||||
redirectUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/callback/google`,
|
||||
wellKnownUrl: 'https://accounts.google.com/.well-known/openid-configuration',
|
||||
bypassEmailVerification: false,
|
||||
};
|
||||
|
||||
export const OidcAuthOptions: OAuthClientOptions = {
|
||||
@ -26,4 +28,5 @@ export const OidcAuthOptions: OAuthClientOptions = {
|
||||
clientSecret: env('NEXT_PRIVATE_OIDC_CLIENT_SECRET') ?? '',
|
||||
redirectUrl: `${NEXT_PUBLIC_WEBAPP_URL()}/api/auth/callback/oidc`,
|
||||
wellKnownUrl: env('NEXT_PRIVATE_OIDC_WELL_KNOWN') ?? '',
|
||||
bypassEmailVerification: env('NEXT_PRIVATE_OIDC_SKIP_VERIFY') === 'true',
|
||||
};
|
||||
|
||||
@ -79,7 +79,7 @@ export const handleOAuthCallbackUrl = async (options: HandleOAuthCallbackUrlOpti
|
||||
});
|
||||
}
|
||||
|
||||
if (claims.email_verified !== true) {
|
||||
if (claims.email_verified !== true && !clientOptions.bypassEmailVerification) {
|
||||
throw new AppError(AuthenticationErrorCode.UnverifiedEmail, {
|
||||
message: 'Account email is not verified',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user