Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

@obelisk/auth

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@obelisk/auth - npm Package Compare versions

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