1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

400s only log out on invalid grant error (#3924)

This commit is contained in:
Kyle Spearrin
2022-10-28 18:10:10 -04:00
committed by GitHub
parent 2cd65939d5
commit 5cb84927ea

View File

@@ -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);
}