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

oidc-jwt-client

Package Overview
Dependencies
Maintainers
4
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oidc-jwt-client - npm Package Compare versions

Comparing version 2.1.0-develop.2 to 2.1.0

43

dist/index.es.js

@@ -840,29 +840,24 @@ import React, { useReducer, useRef, useEffect, useLayoutEffect, useContext, useCallback, useState } from 'react';

},
loadInitialData: function () {
var _a = get().methods, receiveSessionToken = _a.receiveSessionToken, getAccessToken = _a.getAccessToken, getInitialUserInfo = _a.getInitialUserInfo, setInitializedData = _a.setInitializedData;
loadInitialData: function (redirect) {
if (redirect === void 0) { redirect = true; }
var _a = get().methods, receiveSessionToken = _a.receiveSessionToken, getAccessToken = _a.getAccessToken, getUserInfo = _a.getUserInfo, removeTokenFromUrl = _a.removeTokenFromUrl, setInitializedData = _a.setInitializedData;
var token = receiveSessionToken();
return getInitialUserInfo(token, true).then(function () { return getAccessToken().then(function (info) {
var _a;
setInitializedData((_a = info === null || info === void 0 ? void 0 : info.claims) !== null && _a !== void 0 ? _a : null);
}); });
return getUserInfo().then(function (data) {
if (!data || !token) {
setInitializedData(null);
return;
}
if (redirect) {
removeTokenFromUrl();
}
return getAccessToken().then(function (info) {
var _a;
setInitializedData((_a = info === null || info === void 0 ? void 0 : info.claims) !== null && _a !== void 0 ? _a : null);
});
});
},
removeTokenFromUrl: function (data, redirect) {
if (redirect === void 0) { redirect = true; }
if (redirect) {
var urlWithoutToken = stripTokenFromUrl(window.location.href).replace(/\?$/, '').replace(/#\.$/, '');
window.history.replaceState({}, '', urlWithoutToken);
return data;
}
return null;
removeTokenFromUrl: function () {
var urlWithoutToken = stripTokenFromUrl(window.location.href).replace(/\?$/, '').replace(/#\.$/, '');
window.history.replaceState({}, '', urlWithoutToken);
},
getInitialUserInfo: function (token, redirect) {
if (redirect === void 0) { redirect = true; }
var _a = get().methods, getUserInfo = _a.getUserInfo, removeTokenFromUrl = _a.removeTokenFromUrl;
var getUserInfoPromise = getUserInfo();
if (!token)
return getUserInfoPromise;
return getUserInfoPromise
.then(function (data) { return removeTokenFromUrl(data, redirect); })
.catch(function (data) { return removeTokenFromUrl(data, redirect); });
},
receiveSessionToken: function () {

@@ -869,0 +864,0 @@ var setSessionToken = get().methods.setSessionToken;

@@ -848,29 +848,24 @@ 'use strict';

},
loadInitialData: function () {
var _a = get().methods, receiveSessionToken = _a.receiveSessionToken, getAccessToken = _a.getAccessToken, getInitialUserInfo = _a.getInitialUserInfo, setInitializedData = _a.setInitializedData;
loadInitialData: function (redirect) {
if (redirect === void 0) { redirect = true; }
var _a = get().methods, receiveSessionToken = _a.receiveSessionToken, getAccessToken = _a.getAccessToken, getUserInfo = _a.getUserInfo, removeTokenFromUrl = _a.removeTokenFromUrl, setInitializedData = _a.setInitializedData;
var token = receiveSessionToken();
return getInitialUserInfo(token, true).then(function () { return getAccessToken().then(function (info) {
var _a;
setInitializedData((_a = info === null || info === void 0 ? void 0 : info.claims) !== null && _a !== void 0 ? _a : null);
}); });
return getUserInfo().then(function (data) {
if (!data || !token) {
setInitializedData(null);
return;
}
if (redirect) {
removeTokenFromUrl();
}
return getAccessToken().then(function (info) {
var _a;
setInitializedData((_a = info === null || info === void 0 ? void 0 : info.claims) !== null && _a !== void 0 ? _a : null);
});
});
},
removeTokenFromUrl: function (data, redirect) {
if (redirect === void 0) { redirect = true; }
if (redirect) {
var urlWithoutToken = stripTokenFromUrl(window.location.href).replace(/\?$/, '').replace(/#\.$/, '');
window.history.replaceState({}, '', urlWithoutToken);
return data;
}
return null;
removeTokenFromUrl: function () {
var urlWithoutToken = stripTokenFromUrl(window.location.href).replace(/\?$/, '').replace(/#\.$/, '');
window.history.replaceState({}, '', urlWithoutToken);
},
getInitialUserInfo: function (token, redirect) {
if (redirect === void 0) { redirect = true; }
var _a = get().methods, getUserInfo = _a.getUserInfo, removeTokenFromUrl = _a.removeTokenFromUrl;
var getUserInfoPromise = getUserInfo();
if (!token)
return getUserInfoPromise;
return getUserInfoPromise
.then(function (data) { return removeTokenFromUrl(data, redirect); })
.catch(function (data) { return removeTokenFromUrl(data, redirect); });
},
receiveSessionToken: function () {

@@ -877,0 +872,0 @@ var setSessionToken = get().methods.setSessionToken;

@@ -26,17 +26,10 @@ import { UseStore } from 'zustand';

* Receive session token and return user info
* @returns Promise<Claims | User | null>
*/
loadInitialData<Claims extends ClaimsBase, User>(): Promise<void>;
/**
* Try to remove token from url if redirect is true
* @param redirect If true (the default), redirect to the same page without the token.
* @returns User | null
* @returns Promise<void>
*/
removeTokenFromUrl<User>(data: User | null, redirect?: boolean): User | null;
loadInitialData<Claims extends ClaimsBase, User>(redirect?: boolean): Promise<void>;
/**
* Get initial user info promise
* @param redirect If true (the default), redirect to the same page without the token.
* @returns Promise<User | null>
* Try to remove token from url
*/
getInitialUserInfo<User>(token: string | null, redirect?: boolean): Promise<User | null>;
removeTokenFromUrl(): void;
/**

@@ -43,0 +36,0 @@ * Read the session token from the URL. Remove it from the URL if possible.

{
"name": "oidc-jwt-client",
"version": "2.1.0-develop.2",
"version": "2.1.0",
"description": "Fetch JWTs for API access from oidc-jwt-provider",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc