mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +01:00
400s only log out on invalid grant error (#3924)
This commit is contained in:
parent
2cd65939d5
commit
5cb84927ea
@ -2360,16 +2360,6 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
tokenError: boolean,
|
tokenError: boolean,
|
||||||
authed: boolean
|
authed: boolean
|
||||||
): Promise<ErrorResponse> {
|
): Promise<ErrorResponse> {
|
||||||
if (
|
|
||||||
authed &&
|
|
||||||
((tokenError && response.status === 400) ||
|
|
||||||
response.status === 401 ||
|
|
||||||
response.status === 403)
|
|
||||||
) {
|
|
||||||
await this.logoutCallback(true);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let responseJson: any = null;
|
let responseJson: any = null;
|
||||||
if (this.isJsonResponse(response)) {
|
if (this.isJsonResponse(response)) {
|
||||||
responseJson = await response.json();
|
responseJson = await response.json();
|
||||||
@ -2377,6 +2367,20 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
responseJson = { Message: await response.text() };
|
responseJson = { Message: await response.text() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (authed) {
|
||||||
|
if (
|
||||||
|
response.status === 401 ||
|
||||||
|
response.status === 403 ||
|
||||||
|
(tokenError &&
|
||||||
|
response.status === 400 &&
|
||||||
|
responseJson != null &&
|
||||||
|
responseJson.error === "invalid_grant")
|
||||||
|
) {
|
||||||
|
await this.logoutCallback(true);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new ErrorResponse(responseJson, response.status, tokenError);
|
return new ErrorResponse(responseJson, response.status, tokenError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user