[keycloak-dev] KEYCLOAK-2606 - Browsertab-Support for Cordova

Gregor Tudan Gregor.Tudan at cofinpro.de
Tue May 29 07:57:11 EDT 2018

Hey Stian,

Thanks, I took a good look at most of the libraries out there - but I still would love to continue using Keycloak.js.

I got quiet far pretty fast by implementing a second Cordova adapter ("Cordova-native“) and falling back to the old one it the required plugin is missing. Or would you prefer extending the existing Cordova adapter? That would make the code a little messy, since we would need a huge if in every method.

Figuring out the callback wasn’t to hard either - now the last missing piece is parsing the callback. Here we have the option of registering a universal link inside the Keycloak adapter which opens the app, or leaving this to the developer and provide a public method for it (like processCallback).

I’m not quiet sure on these options, what are your thoughts on this?

- Gregor

Am 29.05.2018 um 09:33 schrieb Stian Thorgersen <sthorger at redhat.com<mailto:sthorger at redhat.com>>:

Sounds reasonable. I recommend looking at the following first though before you start implementation AppAuth [1] and OAuth 2.0 for Native Apps [2]

[1] https://appauth.io/
[2] https://tools.ietf.org/html/rfc8252

On 28 May 2018 at 16:34, Gregor Tudan <Gregor.Tudan at cofinpro.de<mailto:Gregor.Tudan at cofinpro.de>> wrote:
Hi there,

I would like to pick up an old issue: KEYCLOAK-2606<https://issues.jboss.org/browse/KEYCLOAK-2606>
Our current app uses Keycloak with the Cordova In-App-Browser. Technically this works fine, but the user experience is … uhmm … awful. The page renders quiet slow and has focus issues.

I’d love to help getting some support for the browser-tab. I started porting the ionic sample app to browertabs, but would like to check back with you before doing something stupid.

The idea is:
1. In Keycloak.js Cordova Adapter check if browertab is supported, else fall back to in-app-browser
2. Open the login-page with the In-App-Browser (leaving the app)
3. Register a custom-url-scheme and configure it as redirect url (i.e. keycloakapp://). We’ll need another Cordova plugin for this (i.e. deep links). The Cordova-Adapter needs to get extended for this, since „localost“ seems to be hardcoded as redirect-url)
4. The Keycloak-server will redirect to the app after login succeeded. The App will need to reinitialize the Keycloak-Adapter with the code given in the url - I’m not sure if this will work out of the box.

Does this sound reasonable?

keycloak-dev mailing list
keycloak-dev at lists.jboss.org<mailto:keycloak-dev at lists.jboss.org>

More information about the keycloak-dev mailing list