Skip to content

Commit

Permalink
Update keycloak js to workaround the cordova in-app browser bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Emily Aung authored May 17, 2021
1 parent 546b6a7 commit deddb7a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions adapters/oidc/js/src/main/resources/keycloak.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
(function(root, factory) {
if ( typeof exports === 'object' ) {
if ( typeof module === 'object' ) {
module.exports = factory( require("js-sha256"), require("base64-js") );
module.exports = factory( require("js-sha256"), require("base64-js") );
} else {
exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
exports["keycloak"] = factory( require("js-sha256"), require("base64-js") );
}
} else {
/**
Expand All @@ -36,7 +36,7 @@
/**
* [base64-js]{@link https://github.com/beatgammit/base64-js}
*
* @version v1.3.0
* @version v1.3.0
* @author Kirill, Fomichev
* @copyright Kirill, Fomichev 2014
* @license MIT
Expand All @@ -46,7 +46,7 @@
/**
* [promise-polyfill]{@link https://github.com/taylorhakes/promise-polyfill}
*
* @version v8.1.3
* @version v8.1.3
* @author Hakes, Taylor
* @copyright Hakes, Taylor 2014
* @license MIT
Expand All @@ -56,7 +56,7 @@
var Keycloak = factory( root["sha256"], root["base64js"] );
root["Keycloak"] = Keycloak;

if ( typeof define === "function" && define.amd ) {
if ( typeof define === "function" && define.amd ) {
define( "keycloak", [], function () { return Keycloak; } );
}
}
Expand Down Expand Up @@ -92,7 +92,7 @@
var promise = this.then(function handleSuccess(value) {
callback(value);
});

return toKeycloakPromise(promise);
};

Expand Down Expand Up @@ -132,7 +132,7 @@
var useNonce = true;
var logInfo = createLogger(console.info);
var logWarn = createLogger(console.warn);

kc.init = function (initOptions) {
kc.authenticated = false;

Expand Down Expand Up @@ -738,6 +738,10 @@
}

function processCallback(oauth, promise) {
if (!oauth) {
promise.setSuccess();
return;
}
var code = oauth.code;
var error = oauth.error;
var prompt = oauth.prompt;
Expand Down Expand Up @@ -1374,6 +1378,7 @@
var closed = false;
var closeBrowser = function() {
closed = true;
ref.show();
ref.close();
};

Expand Down

0 comments on commit deddb7a

Please sign in to comment.