diff --git a/config/default.schema.json b/config/default.schema.json index 1a1fbbb642..54e3ab9c02 100644 --- a/config/default.schema.json +++ b/config/default.schema.json @@ -630,6 +630,11 @@ "type": "boolean", "default": false, "description": "Enables the external system logout feature" + }, + "OAUTH2_LOGIN_REQUEST_TIMEOUT_MS": { + "type": "integer", + "description": "Timeout in milliseconds for oauth2 login", + "default": 8000 } }, "allOf": [ diff --git a/helpers/authentication.js b/helpers/authentication.js index 854287989a..a80053b9b6 100644 --- a/helpers/authentication.js +++ b/helpers/authentication.js @@ -437,6 +437,7 @@ const getAuthenticationUrl = (oauthConfig, state, migration) => { return authenticationUrl.toString(); }; +const oauth2LoginTimeout = Configuration.get('OAUTH2_LOGIN_REQUEST_TIMEOUT_MS'); const requestLogin = (req, strategy, payload = {}) => { switch (strategy) { case 'local': @@ -450,7 +451,7 @@ const requestLogin = (req, strategy, payload = {}) => { .post('/authentication/oauth2', { json: payload }); default: return api(req, { version: 'v1' }) - .post('/authentication', { json: { strategy, ...payload } }); + .post('/authentication', { json: { strategy, ...payload }, timeout: oauth2LoginTimeout }); } };