Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bearer token on signout #201

Merged
merged 3 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ const authClient = new Model({

var deleteHeaders = {
...config.jsonHeaders,
['X-CSRF-Token']: token
['X-CSRF-Token']: token,
['Authorization']: 'Bearer ' + this._bearerToken
yuenmichelle1 marked this conversation as resolved.
Show resolved Hide resolved
};

return makeCredentialHTTPRequest('DELETE', url, null, deleteHeaders)
Expand Down
4 changes: 4 additions & 0 deletions lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ const authClient = new Model({
['X-CSRF-Token']: token
};

if (this._tokenDetails && this._tokenDetails.access_token) {
deleteHeaders['Authorization'] = 'Bearer ' + this._tokenDetails.access_token
}
Comment on lines +134 to +136
Copy link
Contributor

@eatyourgreens eatyourgreens Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comment here. This code is absolutely fine but if the token details are missing, then you aren't logged in anyway (I think.)


return makeCredentialHTTPRequest('DELETE', url, null, deleteHeaders)
.then(function() {
this._deleteBearerToken();
Expand Down