New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-oauth2-pkce

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-oauth2-pkce - npm Package Compare versions

Comparing version 1.0.5 to 2.0.0

1

dist/AuthService.d.ts

@@ -18,2 +18,3 @@ import { PKCECodePair } from './pkce';

expires_in: number;
expires_at?: number;
token_type: string;

@@ -20,0 +21,0 @@ }

22

dist/index.js

@@ -218,2 +218,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

_proto.setAuthTokens = function setAuthTokens(auth) {
var _this$props$refreshSl = this.props.refreshSlack,
refreshSlack = _this$props$refreshSl === void 0 ? 5 : _this$props$refreshSl;
var now = new Date().getTime();
auth.expires_at = now + (auth.expires_in + refreshSlack) * 1000;
window.localStorage.setItem('auth', JSON.stringify(auth));

@@ -300,3 +304,3 @@ };

_this7$props$autoRefr = _this7$props.autoRefresh,
autoRefresh = _this7$props$autoRefr === void 0 ? false : _this7$props$autoRefr;
autoRefresh = _this7$props$autoRefr === void 0 ? true : _this7$props$autoRefr;
var grantType = 'authorization_code';

@@ -344,3 +348,3 @@

return json;
return _this7.getAuthTokens();
});

@@ -356,5 +360,2 @@ });

var _this$props$refreshSl = this.props.refreshSlack,
refreshSlack = _this$props$refreshSl === void 0 ? 10 : _this$props$refreshSl;
if (this.timeout) {

@@ -367,5 +368,5 @@ clearTimeout(this.timeout);

var newRefreshToken = _ref2.refresh_token,
expiresIn = _ref2.expires_in;
expiresAt = _ref2.expires_at;
if (!expiresAt) return;
var now = new Date().getTime();
var expiresAt = now + (expiresIn - refreshSlack) * 1000;
var timeout = expiresAt - now;

@@ -393,4 +394,2 @@

_proto.startTimer = function startTimer() {
var _this$props$refreshSl2 = this.props.refreshSlack,
refreshSlack = _this$props$refreshSl2 === void 0 ? 10 : _this$props$refreshSl2;
var authTokens = this.getAuthTokens();

@@ -403,5 +402,5 @@

var refreshToken = authTokens.refresh_token,
expiresIn = authTokens.expires_in;
expiresAt = authTokens.expires_at;
if (!expiresIn || !refreshToken) {
if (!expiresAt || !refreshToken) {
return;

@@ -411,3 +410,2 @@ }

var now = new Date().getTime();
var expiresAt = now + (expiresIn - refreshSlack) * 1000;
var timeout = expiresAt - now;

@@ -414,0 +412,0 @@

@@ -215,2 +215,6 @@ import React, { useContext } from 'react';

_proto.setAuthTokens = function setAuthTokens(auth) {
var _this$props$refreshSl = this.props.refreshSlack,
refreshSlack = _this$props$refreshSl === void 0 ? 5 : _this$props$refreshSl;
var now = new Date().getTime();
auth.expires_at = now + (auth.expires_in + refreshSlack) * 1000;
window.localStorage.setItem('auth', JSON.stringify(auth));

@@ -297,3 +301,3 @@ };

_this7$props$autoRefr = _this7$props.autoRefresh,
autoRefresh = _this7$props$autoRefr === void 0 ? false : _this7$props$autoRefr;
autoRefresh = _this7$props$autoRefr === void 0 ? true : _this7$props$autoRefr;
var grantType = 'authorization_code';

@@ -341,3 +345,3 @@

return json;
return _this7.getAuthTokens();
});

@@ -353,5 +357,2 @@ });

var _this$props$refreshSl = this.props.refreshSlack,
refreshSlack = _this$props$refreshSl === void 0 ? 10 : _this$props$refreshSl;
if (this.timeout) {

@@ -364,5 +365,5 @@ clearTimeout(this.timeout);

var newRefreshToken = _ref2.refresh_token,
expiresIn = _ref2.expires_in;
expiresAt = _ref2.expires_at;
if (!expiresAt) return;
var now = new Date().getTime();
var expiresAt = now + (expiresIn - refreshSlack) * 1000;
var timeout = expiresAt - now;

@@ -390,4 +391,2 @@

_proto.startTimer = function startTimer() {
var _this$props$refreshSl2 = this.props.refreshSlack,
refreshSlack = _this$props$refreshSl2 === void 0 ? 10 : _this$props$refreshSl2;
var authTokens = this.getAuthTokens();

@@ -400,5 +399,5 @@

var refreshToken = authTokens.refresh_token,
expiresIn = authTokens.expires_in;
expiresAt = authTokens.expires_at;
if (!expiresIn || !refreshToken) {
if (!expiresAt || !refreshToken) {
return;

@@ -408,3 +407,2 @@ }

var now = new Date().getTime();
var expiresAt = now + (expiresIn - refreshSlack) * 1000;
var timeout = expiresAt - now;

@@ -411,0 +409,0 @@

{
"name": "react-oauth2-pkce",
"version": "1.0.5",
"version": "2.0.0",
"description": "Authenticate against generic OAuth2 using PKCE",

@@ -44,2 +44,3 @@ "author": "Gardner Bickford <gardner@bickford.nz>",

"@types/jwt-decode": "^2.2.1",
"@types/mocha": "^8.0.1",
"@types/node": "^12.12.38",

@@ -46,0 +47,0 @@ "@types/react": "^16.9.27",

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