mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-10 15:32:05 -03:30
Use redirectUri for the Cordova adapter (#17038)
This commit is contained in:
parent
9d0bee9c59
commit
537be78455
@ -1418,6 +1418,8 @@ function Keycloak (config) {
|
||||
return formatCordovaOptions(cordovaOptions);
|
||||
};
|
||||
|
||||
var cordovaRedirectUri = kc.redirectUri || 'http://localhost';
|
||||
|
||||
return {
|
||||
login: function(options) {
|
||||
var promise = createPromise();
|
||||
@ -1434,7 +1436,7 @@ function Keycloak (config) {
|
||||
};
|
||||
|
||||
ref.addEventListener('loadstart', function(event) {
|
||||
if (event.url.indexOf('http://localhost') == 0) {
|
||||
if (event.url.indexOf(cordovaRedirectUri) == 0) {
|
||||
var callback = parseCallback(event.url);
|
||||
processCallback(callback, promise);
|
||||
closeBrowser();
|
||||
@ -1444,7 +1446,7 @@ function Keycloak (config) {
|
||||
|
||||
ref.addEventListener('loaderror', function(event) {
|
||||
if (!completed) {
|
||||
if (event.url.indexOf('http://localhost') == 0) {
|
||||
if (event.url.indexOf(cordovaRedirectUri) == 0) {
|
||||
var callback = parseCallback(event.url);
|
||||
processCallback(callback, promise);
|
||||
closeBrowser();
|
||||
@ -1476,13 +1478,13 @@ function Keycloak (config) {
|
||||
var error;
|
||||
|
||||
ref.addEventListener('loadstart', function(event) {
|
||||
if (event.url.indexOf('http://localhost') == 0) {
|
||||
if (event.url.indexOf(cordovaRedirectUri) == 0) {
|
||||
ref.close();
|
||||
}
|
||||
});
|
||||
|
||||
ref.addEventListener('loaderror', function(event) {
|
||||
if (event.url.indexOf('http://localhost') == 0) {
|
||||
if (event.url.indexOf(cordovaRedirectUri) == 0) {
|
||||
ref.close();
|
||||
} else {
|
||||
error = true;
|
||||
@ -1508,7 +1510,7 @@ function Keycloak (config) {
|
||||
var cordovaOptions = createCordovaOptions(options);
|
||||
var ref = cordovaOpenWindowWrapper(registerUrl, '_blank', cordovaOptions);
|
||||
ref.addEventListener('loadstart', function(event) {
|
||||
if (event.url.indexOf('http://localhost') == 0) {
|
||||
if (event.url.indexOf(cordovaRedirectUri) == 0) {
|
||||
ref.close();
|
||||
var oauth = parseCallback(event.url);
|
||||
processCallback(oauth, promise);
|
||||
@ -1522,7 +1524,7 @@ function Keycloak (config) {
|
||||
if (typeof accountUrl !== 'undefined') {
|
||||
var ref = cordovaOpenWindowWrapper(accountUrl, '_blank', 'location=no');
|
||||
ref.addEventListener('loadstart', function(event) {
|
||||
if (event.url.indexOf('http://localhost') == 0) {
|
||||
if (event.url.indexOf(cordovaRedirectUri) == 0) {
|
||||
ref.close();
|
||||
}
|
||||
});
|
||||
@ -1532,7 +1534,7 @@ function Keycloak (config) {
|
||||
},
|
||||
|
||||
redirectUri: function(options) {
|
||||
return 'http://localhost';
|
||||
return cordovaRedirectUri;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user