@okta/okta-auth-js
Advanced tools
Comparing version 2.12.1 to 2.13.0
# Changelog | ||
## 2.13.0 | ||
### Features | ||
- [#324](https://github.com/okta/okta-auth-js/pull/324) - Support `responseMode: "query"` option for SPA apps using PKCE flow | ||
## 2.12.1 | ||
@@ -7,2 +13,3 @@ | ||
- [#315](https://github.com/okta/okta-auth-js/pull/315)`getWellKnown` was using base url over issuer. Method has been fixed to use issuer, if configured, and will fallback to base url | ||
- [#319](https://github.com/okta/okta-auth-js/pull/319) - Setting 'SameSite=lax' for all cookies (Fix for Firefox/Safari) | ||
@@ -9,0 +16,0 @@ |
@@ -51,2 +51,3 @@ /*! | ||
postLogoutRedirectUri: args.postLogoutRedirectUri, | ||
responseMode: args.responseMode, | ||
httpRequestClient: args.httpRequestClient, | ||
@@ -53,0 +54,0 @@ storageUtil: args.storageUtil, |
@@ -239,3 +239,3 @@ /*! | ||
function hashToObject(hash) { | ||
function urlParamsToObject(hashOrSearch) { | ||
// Predefine regexs for parsing hash | ||
@@ -245,4 +245,4 @@ var plus2space = /\+/g; | ||
// Remove the leading hash | ||
var fragment = hash.substring(1); | ||
// Remove the leading # or ? | ||
var fragment = hashOrSearch.substring(1); | ||
@@ -279,3 +279,3 @@ var obj = {}; | ||
loadPopup: loadPopup, | ||
hashToObject: hashToObject, | ||
urlParamsToObject: urlParamsToObject, | ||
isToken: isToken, | ||
@@ -282,0 +282,0 @@ addListener: addListener, |
@@ -629,4 +629,4 @@ /*! | ||
} else { | ||
// general case, client-side flow. | ||
oauthParams.responseMode = 'fragment'; | ||
// Client-side flow can use fragment or query. This can be configured on the SDK instance. | ||
oauthParams.responseMode = sdk.options.responseMode || 'fragment'; | ||
} | ||
@@ -701,10 +701,31 @@ } | ||
function parseFromUrl(sdk, url) { | ||
function removeSearch(sdk) { | ||
var nativeHistory = sdk.token.parseFromUrl._getHistory(); | ||
var nativeDoc = sdk.token.parseFromUrl._getDocument(); | ||
var nativeLoc = sdk.token.parseFromUrl._getLocation(); | ||
var hash = nativeLoc.hash; | ||
if (url) { | ||
hash = url.substring(url.indexOf('#')); | ||
if (nativeHistory && nativeHistory.replaceState) { | ||
nativeHistory.replaceState(null, nativeDoc.title, nativeLoc.pathname + nativeLoc.hash); | ||
} else { | ||
nativeLoc.search = ''; | ||
} | ||
} | ||
if (!hash) { | ||
function parseFromUrl(sdk, options) { | ||
options = options || {}; | ||
if (util.isString(options)) { | ||
options = { url: options }; | ||
} | ||
var url = options.url; | ||
var responseMode = options.responseMode || sdk.options.responseMode || 'fragment'; | ||
var nativeLoc = sdk.token.parseFromUrl._getLocation(); | ||
var paramStr; | ||
if (responseMode === 'query') { | ||
paramStr = url ? url.substring(url.indexOf('?')) : nativeLoc.search; | ||
} else { | ||
paramStr = url ? url.substring(url.indexOf('#')) : nativeLoc.hash; | ||
} | ||
if (!paramStr) { | ||
return Q.reject(new AuthSdkError('Unable to parse a token from the url')); | ||
@@ -728,7 +749,7 @@ } | ||
return Q.resolve(oauthUtil.hashToObject(hash)) | ||
return Q.resolve(oauthUtil.urlParamsToObject(paramStr)) | ||
.then(function(res) { | ||
if (!url) { | ||
// Remove the hash from the url | ||
removeHash(sdk); | ||
// Clean hash or search from the url | ||
responseMode === 'query' ? removeSearch(sdk) : removeHash(sdk); | ||
} | ||
@@ -735,0 +756,0 @@ return handleOAuthResponse(sdk, oauthParams, res, urls); |
{ | ||
"name": "@okta/okta-auth-js", | ||
"description": "The Okta Auth SDK", | ||
"version": "2.12.1", | ||
"version": "2.13.0", | ||
"homepage": "https://github.com/okta/okta-auth-js", | ||
@@ -71,5 +71,5 @@ "license": "Apache-2.0", | ||
"okta": { | ||
"commitSha": "a97fc3a33453c71fa0578fa019e91f8f3cd2da9c", | ||
"fullVersion": "2.12.1-20200123003811-a97fc3a" | ||
"commitSha": "6e236a4065036704816a9630079106421f90ba0d", | ||
"fullVersion": "2.13.0-20200129212640-6e236a4" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
802503
3512
1934