@obelisk/auth
Advanced tools
Comparing version 3.1.0 to 3.1.2
@@ -58,4 +58,3 @@ import { AuthEvent, ObeliskAuth } from './auth'; | ||
private captureTokens; | ||
private checkOldToken; | ||
private parseJwtString; | ||
} |
@@ -508,17 +508,19 @@ var AuthEventType; | ||
// No remember_me: remove any other remember_me tokens | ||
this.checkOldToken(tokenResponse.id_token); | ||
// this.checkOldToken(tokenResponse.id_token); | ||
// UNDO previous: remove all tokens (also previous ones of yourself: no remember_me is a choice..) | ||
localStorage.removeItem(KEY_ID_TOK); | ||
} | ||
return res; | ||
}; | ||
ObeliskAuthClient.prototype.checkOldToken = function (newIdToken) { | ||
var oldTok = localStorage.getItem(KEY_ID_TOK); | ||
if (oldTok) { | ||
var oldTokJson = this.parseJwtString(oldTok); | ||
var newTokJson = this.parseJwtString(newIdToken); | ||
if (oldTokJson.email !== newTokJson.email) { | ||
// Delete token if not yours | ||
localStorage.removeItem(KEY_ID_TOK); | ||
} | ||
} | ||
}; | ||
// private checkOldToken(newIdToken: any) { | ||
// const oldTok = localStorage.getItem(KEY_ID_TOK); | ||
// if (oldTok) { | ||
// const oldTokJson = this.parseJwtString(oldTok); | ||
// const newTokJson = this.parseJwtString(newIdToken); | ||
// if (oldTokJson.email !== newTokJson.email) { | ||
// // Delete token if not yours | ||
// localStorage.removeItem(KEY_ID_TOK); | ||
// } | ||
// } | ||
// } | ||
ObeliskAuthClient.prototype.parseJwtString = function (token) { | ||
@@ -525,0 +527,0 @@ return JSON.parse(atob(token.split('.')[1])); |
@@ -511,17 +511,19 @@ 'use strict'; | ||
// No remember_me: remove any other remember_me tokens | ||
this.checkOldToken(tokenResponse.id_token); | ||
// this.checkOldToken(tokenResponse.id_token); | ||
// UNDO previous: remove all tokens (also previous ones of yourself: no remember_me is a choice..) | ||
localStorage.removeItem(KEY_ID_TOK); | ||
} | ||
return res; | ||
}; | ||
ObeliskAuthClient.prototype.checkOldToken = function (newIdToken) { | ||
var oldTok = localStorage.getItem(KEY_ID_TOK); | ||
if (oldTok) { | ||
var oldTokJson = this.parseJwtString(oldTok); | ||
var newTokJson = this.parseJwtString(newIdToken); | ||
if (oldTokJson.email !== newTokJson.email) { | ||
// Delete token if not yours | ||
localStorage.removeItem(KEY_ID_TOK); | ||
} | ||
} | ||
}; | ||
// private checkOldToken(newIdToken: any) { | ||
// const oldTok = localStorage.getItem(KEY_ID_TOK); | ||
// if (oldTok) { | ||
// const oldTokJson = this.parseJwtString(oldTok); | ||
// const newTokJson = this.parseJwtString(newIdToken); | ||
// if (oldTokJson.email !== newTokJson.email) { | ||
// // Delete token if not yours | ||
// localStorage.removeItem(KEY_ID_TOK); | ||
// } | ||
// } | ||
// } | ||
ObeliskAuthClient.prototype.parseJwtString = function (token) { | ||
@@ -528,0 +530,0 @@ return JSON.parse(atob(token.split('.')[1])); |
{ | ||
"name": "@obelisk/auth", | ||
"version": "3.1.0", | ||
"version": "3.1.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1159
150475