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 1.0.5 to 1.0.6

25

dist/index.es.js

@@ -565,3 +565,3 @@ import { createContext, useMemo, useEffect, createElement, useState, useContext } from 'react';

this.baseUrl = options.url.replace(/\/$/, '');
this.csrfToken = (_a = sessionStorage.getItem(this.csrfTokenStorageKey)) !== null && _a !== void 0 ? _a : null;
this.csrfToken = (_a = localStorage.getItem(this.csrfTokenStorageKey)) !== null && _a !== void 0 ? _a : null;
this.authorizationDefaults = (_b = options.authorizationDefaults) !== null && _b !== void 0 ? _b : {};

@@ -586,3 +586,4 @@ }

if (redirect || typeof redirect === 'undefined') {
window.location.href = stripTokenFromUrl(window.location.href).replace(/\?$/, '');
// TODO: Still need to figure out why #. is appearing in url
window.location.href = stripTokenFromUrl(window.location.href).replace(/\?$/, '').replace(/#\.$/, '');
return true;

@@ -594,3 +595,3 @@ }

this.csrfToken = token;
sessionStorage.setItem(this.csrfTokenStorageKey, this.csrfToken);
localStorage.setItem(this.csrfTokenStorageKey, this.csrfToken);
};

@@ -695,3 +696,3 @@ OidcJwtClientImpl.prototype.authorize = function (params) {

var OidcJwtProvider = function (props) {
var clientProp = props.client, _a = props.shouldRequireLogin, shouldRequireLogin = _a === void 0 ? false : _a, _b = props.shouldAttemptLogin, shouldAttemptLogin = _b === void 0 ? false : _b, _c = props.shouldMonitorAccessTokens, shouldMonitorAccessTokens = _c === void 0 ? true : _c, children = props.children;
var clientProp = props.client, _a = props.shouldAttemptLogin, shouldAttemptLogin = _a === void 0 ? false : _a, _b = props.shouldMonitorAccessTokens, shouldMonitorAccessTokens = _b === void 0 ? true : _b, children = props.children;
var contextValue = useMemo(function () {

@@ -716,7 +717,3 @@ return {

if (shouldAttemptLogin) {
var params = {};
if (!shouldRequireLogin) {
params.prompt = 'none';
}
client.authorize(params);
client.authorize({ prompt: 'none' });
}

@@ -731,13 +728,3 @@ }

shouldAttemptLogin,
shouldRequireLogin,
]);
useEffect(function () {
if (shouldRequireLogin) {
client.getAccessToken().then(function (result) {
if (!(result === null || result === void 0 ? void 0 : result.token)) {
client.authorize();
}
});
}
}, [client, shouldRequireLogin]);
return createElement(OidcJwtContext.Provider, { value: contextValue }, children);

@@ -744,0 +731,0 @@ };

@@ -569,3 +569,3 @@ 'use strict';

this.baseUrl = options.url.replace(/\/$/, '');
this.csrfToken = (_a = sessionStorage.getItem(this.csrfTokenStorageKey)) !== null && _a !== void 0 ? _a : null;
this.csrfToken = (_a = localStorage.getItem(this.csrfTokenStorageKey)) !== null && _a !== void 0 ? _a : null;
this.authorizationDefaults = (_b = options.authorizationDefaults) !== null && _b !== void 0 ? _b : {};

@@ -590,3 +590,4 @@ }

if (redirect || typeof redirect === 'undefined') {
window.location.href = stripTokenFromUrl(window.location.href).replace(/\?$/, '');
// TODO: Still need to figure out why #. is appearing in url
window.location.href = stripTokenFromUrl(window.location.href).replace(/\?$/, '').replace(/#\.$/, '');
return true;

@@ -598,3 +599,3 @@ }

this.csrfToken = token;
sessionStorage.setItem(this.csrfTokenStorageKey, this.csrfToken);
localStorage.setItem(this.csrfTokenStorageKey, this.csrfToken);
};

@@ -699,3 +700,3 @@ OidcJwtClientImpl.prototype.authorize = function (params) {

var OidcJwtProvider = function (props) {
var clientProp = props.client, _a = props.shouldRequireLogin, shouldRequireLogin = _a === void 0 ? false : _a, _b = props.shouldAttemptLogin, shouldAttemptLogin = _b === void 0 ? false : _b, _c = props.shouldMonitorAccessTokens, shouldMonitorAccessTokens = _c === void 0 ? true : _c, children = props.children;
var clientProp = props.client, _a = props.shouldAttemptLogin, shouldAttemptLogin = _a === void 0 ? false : _a, _b = props.shouldMonitorAccessTokens, shouldMonitorAccessTokens = _b === void 0 ? true : _b, children = props.children;
var contextValue = React.useMemo(function () {

@@ -720,7 +721,3 @@ return {

if (shouldAttemptLogin) {
var params = {};
if (!shouldRequireLogin) {
params.prompt = 'none';
}
client.authorize(params);
client.authorize({ prompt: 'none' });
}

@@ -735,13 +732,3 @@ }

shouldAttemptLogin,
shouldRequireLogin,
]);
React.useEffect(function () {
if (shouldRequireLogin) {
client.getAccessToken().then(function (result) {
if (!(result === null || result === void 0 ? void 0 : result.token)) {
client.authorize();
}
});
}
}, [client, shouldRequireLogin]);
return React.createElement(OidcJwtContext.Provider, { value: contextValue }, children);

@@ -748,0 +735,0 @@ };

@@ -5,3 +5,2 @@ import * as React from 'react';

client: OidcJwtClient | OidcJwtClientOptions;
shouldRequireLogin?: boolean;
shouldAttemptLogin?: boolean;

@@ -8,0 +7,0 @@ shouldMonitorAccessTokens?: boolean;

{
"name": "oidc-jwt-client",
"version": "1.0.5",
"version": "1.0.6",
"description": "Fetch JWTs for API access from oidc-jwt-provider",

@@ -92,3 +92,8 @@ "main": "dist/index.js",

},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {}
}

@@ -11,3 +11,2 @@ # oidc-jwt-client

client={{ url: 'https://api-auth.acc.titan.awssdu.nl' }}
shouldRequireLogin={false}
shouldAttemptLogin={false}

@@ -23,3 +22,3 @@ shouldMonitorAccessTokens={false}

The accessToken is directly returned from the fetchAccessToken function when already present and valid.
The accessToken is directly returned from the fetchAccessToken function when already present and valid.
If not it will automatically fetch a new accessToken for you.

@@ -71,3 +70,3 @@

### Check session
### Check session
To check if there is a session and for example show a loader when there's not yet one:

@@ -78,2 +77,2 @@

console.log('There is a session started: ', sessionInfo.hasSession)
```
```

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