Ionic 2: login via keycloak won't store keyclo

2019-06-12 03:08发布

问题:

I am building Ionic 2 app and I want to use Keycloak for login/signup.

I have the following situation:

I am on Keycloak login page and when I login, I am redirect back to my app. I would expect that Keycloak will set cookies, but it didn't. I guess it is because of this: Can you use cookies in a Cordova application?.

Is there any way how to tell Keycloak to use local storage instead of cookies. Or any other solution?

I am using this implementation of keycloak & angular 2 colaboration.

回答1:

In the Keycloak there is a Javascript Adapter - keycloak.js, it already knows how to work with a Cordova application, it is only necessary to disable the token checking through the iframe.

I created a simple app Ionic2 with Keycloak integration https://github.com/sergeyrolich/ionic2-keycloak