refactor: 💡 deauth should delete the auth token (#1256)

This commit is contained in:
Randall Morey authored and GitHub committed 2022-08-15 11:22:27 -07:00
1 parent e3324ad64a
commit 7386b2c9ed
4 files changed
+15 -10

No files matched your search

+6 -2
View File
@@ -105,9 +105,13 @@ export default class BaseAuthenticator extends SimpleAuthBaseAuthenticator {
* @override
* @return {Promise}
*/
invalidate(options) {
async invalidate(options) {
const { token } = options;
const deauthEndpointURL = this.buildDeauthEndpointURL(options);
fetch(deauthEndpointURL, { method: 'post' }).catch(() => {
await fetch(deauthEndpointURL, {
method: 'delete',
headers: { Authorization: `Bearer ${token}` },
}).catch(() => {
/* no op */
});
return super.invalidate(...arguments);