From 1f565b48475b350a5d8162eef5b28655e7555c8f Mon Sep 17 00:00:00 2001 From: wayglem Date: Wed, 14 Feb 2018 00:42:37 +0100 Subject: [PATCH] show oauth error callback message when auth fails (#4058) This change aims to display the oauth error to the user when the autnetication process fails. Close #4048 --- dev-helpers/oauth2-redirect.html | 9 ++++++++- dist/oauth2-redirect.html | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dev-helpers/oauth2-redirect.html b/dev-helpers/oauth2-redirect.html index eb00dc68..fb68399d 100644 --- a/dev-helpers/oauth2-redirect.html +++ b/dev-helpers/oauth2-redirect.html @@ -45,11 +45,18 @@ oauth2.auth.code = qp.code; oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl}); } else { + let oauthErrorMsg + if (qp.error) { + oauthErrorMsg = "["+qp.error+"]: " + + (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") + + (qp.error_uri ? "More info: "+qp.error_uri : ""); + } + oauth2.errCb({ authId: oauth2.auth.name, source: "auth", level: "error", - message: "Authorization failed: no accessCode received from the server" + message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server" }); } } else { diff --git a/dist/oauth2-redirect.html b/dist/oauth2-redirect.html index eb00dc68..fb68399d 100644 --- a/dist/oauth2-redirect.html +++ b/dist/oauth2-redirect.html @@ -45,11 +45,18 @@ oauth2.auth.code = qp.code; oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl}); } else { + let oauthErrorMsg + if (qp.error) { + oauthErrorMsg = "["+qp.error+"]: " + + (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") + + (qp.error_uri ? "More info: "+qp.error_uri : ""); + } + oauth2.errCb({ authId: oauth2.auth.name, source: "auth", level: "error", - message: "Authorization failed: no accessCode received from the server" + message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server" }); } } else {