mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-29 12:55:21 +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,
|
||||
authed: boolean
|
||||
): Promise<ErrorResponse> {
|
||||
if (
|
||||
authed &&
|
||||
((tokenError && response.status === 400) ||
|
||||
response.status === 401 ||
|
||||
response.status === 403)
|
||||
) {
|
||||
await this.logoutCallback(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
let responseJson: any = null;
|
||||
if (this.isJsonResponse(response)) {
|
||||
responseJson = await response.json();
|
||||
@ -2377,6 +2367,20 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user