react-oauth2-pkce
Advanced tools
Comparing version 2.0.5 to 2.0.6
@@ -10,2 +10,3 @@ import { PKCECodePair } from './pkce'; | ||
tokenEndpoint?: string; | ||
audience?: string; | ||
redirectUri?: string; | ||
@@ -12,0 +13,0 @@ scopes: string[]; |
@@ -73,7 +73,10 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
function _createForOfIteratorHelperLoose(o) { | ||
var i = 0; | ||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (it) return (it = it.call(o)).next.bind(it); | ||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { | ||
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) return function () { | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
return function () { | ||
if (i >= o.length) return { | ||
@@ -87,7 +90,5 @@ 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."); | ||
} | ||
i = o[Symbol.iterator](); | ||
return i.next.bind(i); | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -272,3 +273,4 @@ | ||
redirectUri = _this$props.redirectUri, | ||
scopes = _this$props.scopes; | ||
scopes = _this$props.scopes, | ||
audience = _this$props.audience; | ||
var pkce = createPKCECodes(); | ||
@@ -279,10 +281,15 @@ window.localStorage.setItem('pkce', JSON.stringify(pkce)); | ||
var codeChallenge = pkce.codeChallenge; | ||
var query = { | ||
var query = _extends({ | ||
clientId: clientId, | ||
scope: scopes.join(' '), | ||
responseType: 'code', | ||
redirectUri: redirectUri, | ||
redirectUri: redirectUri | ||
}, audience && { | ||
audience: audience | ||
}, { | ||
codeChallenge: codeChallenge, | ||
codeChallengeMethod: 'S256' | ||
}; | ||
}); | ||
var url = (authorizeEndpoint || provider + "/authorize") + "?" + toUrlEncoded(query); | ||
@@ -312,7 +319,7 @@ window.location.replace(url); | ||
var payload = _extends(_extends({ | ||
var payload = _extends({ | ||
clientId: clientId | ||
}, clientSecret ? { | ||
clientSecret: clientSecret | ||
} : {}), {}, { | ||
} : {}, { | ||
redirectUri: redirectUri, | ||
@@ -323,3 +330,3 @@ grantType: grantType | ||
if (isRefresh) { | ||
payload = _extends(_extends({}, payload), {}, { | ||
payload = _extends({}, payload, { | ||
grantType: 'refresh_token', | ||
@@ -332,3 +339,3 @@ refresh_token: code | ||
var codeVerifier = pkce.codeVerifier; | ||
payload = _extends(_extends({}, payload), {}, { | ||
payload = _extends({}, payload, { | ||
code: code, | ||
@@ -335,0 +342,0 @@ codeVerifier: codeVerifier |
@@ -70,7 +70,10 @@ import React, { useContext } from 'react'; | ||
function _createForOfIteratorHelperLoose(o) { | ||
var i = 0; | ||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { | ||
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; | ||
if (it) return (it = it.call(o)).next.bind(it); | ||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { | ||
if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) return function () { | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
return function () { | ||
if (i >= o.length) return { | ||
@@ -84,7 +87,5 @@ 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."); | ||
} | ||
i = o[Symbol.iterator](); | ||
return i.next.bind(i); | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -269,3 +270,4 @@ | ||
redirectUri = _this$props.redirectUri, | ||
scopes = _this$props.scopes; | ||
scopes = _this$props.scopes, | ||
audience = _this$props.audience; | ||
var pkce = createPKCECodes(); | ||
@@ -276,10 +278,15 @@ window.localStorage.setItem('pkce', JSON.stringify(pkce)); | ||
var codeChallenge = pkce.codeChallenge; | ||
var query = { | ||
var query = _extends({ | ||
clientId: clientId, | ||
scope: scopes.join(' '), | ||
responseType: 'code', | ||
redirectUri: redirectUri, | ||
redirectUri: redirectUri | ||
}, audience && { | ||
audience: audience | ||
}, { | ||
codeChallenge: codeChallenge, | ||
codeChallengeMethod: 'S256' | ||
}; | ||
}); | ||
var url = (authorizeEndpoint || provider + "/authorize") + "?" + toUrlEncoded(query); | ||
@@ -309,7 +316,7 @@ window.location.replace(url); | ||
var payload = _extends(_extends({ | ||
var payload = _extends({ | ||
clientId: clientId | ||
}, clientSecret ? { | ||
clientSecret: clientSecret | ||
} : {}), {}, { | ||
} : {}, { | ||
redirectUri: redirectUri, | ||
@@ -320,3 +327,3 @@ grantType: grantType | ||
if (isRefresh) { | ||
payload = _extends(_extends({}, payload), {}, { | ||
payload = _extends({}, payload, { | ||
grantType: 'refresh_token', | ||
@@ -329,3 +336,3 @@ refresh_token: code | ||
var codeVerifier = pkce.codeVerifier; | ||
payload = _extends(_extends({}, payload), {}, { | ||
payload = _extends({}, payload, { | ||
code: code, | ||
@@ -332,0 +339,0 @@ codeVerifier: codeVerifier |
{ | ||
"name": "react-oauth2-pkce", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "Authenticate against generic OAuth2 using PKCE", | ||
@@ -5,0 +5,0 @@ "author": "Gardner Bickford <gardner@bickford.nz>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
74554
818