Skip to content

Commit

Permalink
Fix bugs (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitrySharabin authored Aug 14, 2024
1 parent 6ed3b8d commit 39075ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/oauth-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class OAuthBackend extends AuthBackend {
*/
async request (call, data, method = "GET", req) {
req = Object.assign({}, req); // clone
req.headers ??= {};

if (this.isAuthenticated()) {
req.headers["Authorization"] = req.headers["Authorization"] || `Bearer ${this.accessToken}`;
Expand Down Expand Up @@ -139,7 +140,7 @@ export default class OAuthBackend extends AuthBackend {
this.updatePermissions({login: false, logout: true});
return currentUser;
}
else if (this.isAuthenticated()) {
else if (!this.isAuthenticated()) {
throw new Error(this.constructor.phrase("invalid_access_token"));
}
}
Expand Down

0 comments on commit 39075ad

Please sign in to comment.