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
This commit is contained in:
@@ -45,11 +45,18 @@
|
|||||||
oauth2.auth.code = qp.code;
|
oauth2.auth.code = qp.code;
|
||||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
} else {
|
} 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({
|
oauth2.errCb({
|
||||||
authId: oauth2.auth.name,
|
authId: oauth2.auth.name,
|
||||||
source: "auth",
|
source: "auth",
|
||||||
level: "error",
|
level: "error",
|
||||||
message: "Authorization failed: no accessCode received from the server"
|
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
9
dist/oauth2-redirect.html
vendored
9
dist/oauth2-redirect.html
vendored
@@ -45,11 +45,18 @@
|
|||||||
oauth2.auth.code = qp.code;
|
oauth2.auth.code = qp.code;
|
||||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||||
} else {
|
} 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({
|
oauth2.errCb({
|
||||||
authId: oauth2.auth.name,
|
authId: oauth2.auth.name,
|
||||||
source: "auth",
|
source: "auth",
|
||||||
level: "error",
|
level: "error",
|
||||||
message: "Authorization failed: no accessCode received from the server"
|
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user