diff --git a/examples/cordova/www/index.html b/examples/cordova/www/index.html
index 91d97220b5..88852671f2 100644
--- a/examples/cordova/www/index.html
+++ b/examples/cordova/www/index.html
@@ -8,14 +8,11 @@
@@ -42,6 +37,7 @@
+
diff --git a/integration/js/src/main/resources/keycloak.js b/integration/js/src/main/resources/keycloak.js
index 1cfba8100a..04b48f735a 100755
--- a/integration/js/src/main/resources/keycloak.js
+++ b/integration/js/src/main/resources/keycloak.js
@@ -617,6 +617,8 @@ var Keycloak = function (config) {
}
if (type == 'cordova') {
+ loginIframe.enable = false;
+
return {
login: function(options) {
var promise = createPromise();
diff --git a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java
index 0edf915555..1db8230e9d 100755
--- a/services/src/main/java/org/keycloak/services/resources/RealmsResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/RealmsResource.java
@@ -128,7 +128,11 @@ public class RealmsResource {
}
for (String r : TokenService.resolveValidRedirects(uriInfo, client.getRedirectUris())) {
- r = r.substring(0, r.indexOf('/', 8));
+ int i = r.indexOf('/', 8);
+ if (i != -1) {
+ r = r.substring(0, i);
+ }
+
if (r.equals(origin)) {
valid = true;
break;