mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Return more error messages (#14066)
This commit is contained in:
@@ -5,11 +5,11 @@ import ms from 'ms';
|
||||
import { Client, errors, generators, Issuer } from 'openid-client';
|
||||
import { getAuthProvider } from '../../auth';
|
||||
import env from '../../env';
|
||||
import { BaseException } from '@directus/shared/exceptions';
|
||||
import {
|
||||
InvalidConfigException,
|
||||
InvalidCredentialsException,
|
||||
InvalidTokenException,
|
||||
InvalidProviderException,
|
||||
ServiceUnavailableException,
|
||||
} from '../../exceptions';
|
||||
import logger from '../../logger';
|
||||
@@ -294,14 +294,8 @@ export function createOAuth2AuthRouter(providerName: string): Router {
|
||||
if (redirect) {
|
||||
let reason = 'UNKNOWN_EXCEPTION';
|
||||
|
||||
if (error instanceof ServiceUnavailableException) {
|
||||
reason = 'SERVICE_UNAVAILABLE';
|
||||
} else if (error instanceof InvalidCredentialsException) {
|
||||
reason = 'INVALID_USER';
|
||||
} else if (error instanceof InvalidTokenException) {
|
||||
reason = 'INVALID_TOKEN';
|
||||
} else if (error instanceof InvalidProviderException) {
|
||||
reason = 'INVALID_PROVIDER';
|
||||
if (error instanceof BaseException) {
|
||||
reason = error.code;
|
||||
} else {
|
||||
logger.warn(error, `[OAuth2] Unexpected error during OAuth2 login`);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import ms from 'ms';
|
||||
import { Client, errors, generators, Issuer } from 'openid-client';
|
||||
import { getAuthProvider } from '../../auth';
|
||||
import env from '../../env';
|
||||
import { BaseException } from '@directus/shared/exceptions';
|
||||
import {
|
||||
InvalidConfigException,
|
||||
InvalidCredentialsException,
|
||||
InvalidTokenException,
|
||||
InvalidProviderException,
|
||||
ServiceUnavailableException,
|
||||
} from '../../exceptions';
|
||||
import logger from '../../logger';
|
||||
@@ -317,14 +317,8 @@ export function createOpenIDAuthRouter(providerName: string): Router {
|
||||
if (redirect) {
|
||||
let reason = 'UNKNOWN_EXCEPTION';
|
||||
|
||||
if (error instanceof ServiceUnavailableException) {
|
||||
reason = 'SERVICE_UNAVAILABLE';
|
||||
} else if (error instanceof InvalidCredentialsException) {
|
||||
reason = 'INVALID_USER';
|
||||
} else if (error instanceof InvalidTokenException) {
|
||||
reason = 'INVALID_TOKEN';
|
||||
} else if (error instanceof InvalidProviderException) {
|
||||
reason = 'INVALID_PROVIDER';
|
||||
if (error instanceof BaseException) {
|
||||
reason = error.code;
|
||||
} else {
|
||||
logger.warn(error, `[OpenID] Unexpected error during OpenID login`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user