From afc28f755a63d494b408279801471a43f5b16565 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Tue, 27 Aug 2019 11:17:22 +0200
Subject: [PATCH] Handle keycloak redirects with an existing routing hash

The keycloack token doesn't have to be the first thing in the hash
so don't assume it starts with a #
---
 packages/auth/src/vpu-auth.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/auth/src/vpu-auth.js b/packages/auth/src/vpu-auth.js
index 677a7d10..a34609ee 100644
--- a/packages/auth/src/vpu-auth.js
+++ b/packages/auth/src/vpu-auth.js
@@ -68,7 +68,7 @@ class VPUAuth extends LitElement {
         }
 
         // load Keycloak if we want to force the login or if we were redirected from the Keycloak login page
-        if (this.forceLogin || (href.indexOf('#state=') > 0 && href.indexOf('&session_state=') > 0)) {
+        if (this.forceLogin || (href.search('[&#]state=') >= 0 && href.search('[&#]session_state=') >= 0)) {
             this.loadKeycloak();
         }
 
-- 
GitLab