Huge News!Announcing our $40M Series B led by Abstract Ventures.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 2.0.6 to 2.0.7

3

dist/AuthService.d.ts

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

tokenEndpoint?: string;
logoutEndpoint?: string;
audience?: string;

@@ -54,3 +55,3 @@ redirectUri?: string;

isAuthenticated(): boolean;
logout(): Promise<boolean>;
logout(shouldEndSession?: boolean): Promise<boolean>;
login(): Promise<void>;

@@ -57,0 +58,0 @@ authorize(): boolean;

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

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
function _createForOfIteratorHelperLoose(o) {
var i = 0;
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) return function () {
if (i >= o.length) return {

@@ -90,5 +87,7 @@ done: true

};
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
i = o[Symbol.iterator]();
return i.next.bind(i);
}

@@ -240,3 +239,7 @@

_proto.logout = function logout() {
_proto.logout = function logout(shouldEndSession) {
if (shouldEndSession === void 0) {
shouldEndSession = false;
}
try {

@@ -249,4 +252,19 @@ var _this3 = this;

window.location.reload();
return Promise.resolve(true);
if (shouldEndSession) {
var _this3$props = _this3.props,
clientId = _this3$props.clientId,
provider = _this3$props.provider,
logoutEndpoint = _this3$props.logoutEndpoint,
redirectUri = _this3$props.redirectUri;
var query = {
client_id: clientId,
post_logout_redirect_uri: redirectUri
};
var url = (logoutEndpoint || provider + "/logout") + "?" + toUrlEncoded(query);
window.location.replace(url);
return Promise.resolve(true);
} else {
window.location.reload();
return Promise.resolve(true);
}
} catch (e) {

@@ -283,3 +301,3 @@ return Promise.reject(e);

var query = _extends({
var query = _extends(_extends({
clientId: clientId,

@@ -291,3 +309,3 @@ scope: scopes.join(' '),

audience: audience
}, {
}), {}, {
codeChallenge: codeChallenge,

@@ -321,7 +339,7 @@ codeChallengeMethod: 'S256'

var payload = _extends({
var payload = _extends(_extends({
clientId: clientId
}, clientSecret ? {
clientSecret: clientSecret
} : {}, {
} : {}), {}, {
redirectUri: redirectUri,

@@ -332,3 +350,3 @@ grantType: grantType

if (isRefresh) {
payload = _extends({}, payload, {
payload = _extends(_extends({}, payload), {}, {
grantType: 'refresh_token',

@@ -341,3 +359,3 @@ refresh_token: code

var codeVerifier = pkce.codeVerifier;
payload = _extends({}, payload, {
payload = _extends(_extends({}, payload), {}, {
code: code,

@@ -344,0 +362,0 @@ codeVerifier: codeVerifier

@@ -70,10 +70,7 @@ import React, { useContext } from 'react';

function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
function _createForOfIteratorHelperLoose(o) {
var i = 0;
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) return function () {
if (i >= o.length) return {

@@ -87,5 +84,7 @@ done: true

};
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
i = o[Symbol.iterator]();
return i.next.bind(i);
}

@@ -237,3 +236,7 @@

_proto.logout = function logout() {
_proto.logout = function logout(shouldEndSession) {
if (shouldEndSession === void 0) {
shouldEndSession = false;
}
try {

@@ -246,4 +249,19 @@ var _this3 = this;

window.location.reload();
return Promise.resolve(true);
if (shouldEndSession) {
var _this3$props = _this3.props,
clientId = _this3$props.clientId,
provider = _this3$props.provider,
logoutEndpoint = _this3$props.logoutEndpoint,
redirectUri = _this3$props.redirectUri;
var query = {
client_id: clientId,
post_logout_redirect_uri: redirectUri
};
var url = (logoutEndpoint || provider + "/logout") + "?" + toUrlEncoded(query);
window.location.replace(url);
return Promise.resolve(true);
} else {
window.location.reload();
return Promise.resolve(true);
}
} catch (e) {

@@ -280,3 +298,3 @@ return Promise.reject(e);

var query = _extends({
var query = _extends(_extends({
clientId: clientId,

@@ -288,3 +306,3 @@ scope: scopes.join(' '),

audience: audience
}, {
}), {}, {
codeChallenge: codeChallenge,

@@ -318,7 +336,7 @@ codeChallengeMethod: 'S256'

var payload = _extends({
var payload = _extends(_extends({
clientId: clientId
}, clientSecret ? {
clientSecret: clientSecret
} : {}, {
} : {}), {}, {
redirectUri: redirectUri,

@@ -329,3 +347,3 @@ grantType: grantType

if (isRefresh) {
payload = _extends({}, payload, {
payload = _extends(_extends({}, payload), {}, {
grantType: 'refresh_token',

@@ -338,3 +356,3 @@ refresh_token: code

var codeVerifier = pkce.codeVerifier;
payload = _extends({}, payload, {
payload = _extends(_extends({}, payload), {}, {
code: code,

@@ -341,0 +359,0 @@ codeVerifier: codeVerifier

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

@@ -5,0 +5,0 @@ "author": "Gardner Bickford <gardner@bickford.nz>",

@@ -42,6 +42,9 @@ # react-oauth2-pkce

After https://github.com/gardner/react-oauth2-pkce/pull/16 it is possible to pass in just `provider` or `authorizeEndpoint` and `tokenEndpoint`. These two parameters were added to maintain backwards compatibility while enabling callers to customize the endpoint.
After https://github.com/gardner/react-oauth2-pkce/pull/16 it is possible to pass in just `provider` or `authorizeEndpoint`, `tokenEndpoint` and `logoutEndpoint`. These two parameters were added to maintain backwards compatibility while enabling callers to customize the endpoint.
### End User Session on "Single Application Logout"
You can end user session when calling `logout(true)`. A custom endpoint can configured by passing `logoutEndpoint` as props. The user will be redirected to the `redirectUri`.
## License
MIT © [Gardner Bickford](https://github.com/gardner)

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