Ember and Keycloak integration

Hi everybody,

My question is quite simple : does anybody know how to integrate Ember.JS and Keycloak (the SSO system) ? We currently face a problem using the Keycloak JS Bower library (https://github.com/keycloak/keycloak-js-bower) to redirect users to Keycloak own login page, and to generally integrate Ember.JS with Keycloak. Our problems are :

  • Double page reload on page reloading,

  • 401 unauthorized HTTP code on login to the Ember App.

Thanks for your (precious) support.

I’m working on connecting an Ember frontend to a KeyCloak protected backend. I haven’t started yet, I’m currently on the research stage, but I found ember-keycloak-auth and I’m about to test it.

What did you do in the end?

Hello Jcano,

My case is a little bit tricky because I try to redirect from my EmberJS frontend to Keycloak login page. I got the code from ember-keycloak-auth to use only the service code but I currently have a problem on login directly on a page which needs to make calls to backend. Ember Simple Auth and Keycloak seem to authenticate after the calls to the backend and it results in a 401 unauthorized call. Let me know if you face the same problems.

At the moment I don’t have those issues, I’m creating my own login page and sending my credentials to the KeyCloak backend from Ember using Ember Simple Auth on it’s own, without ember-keycloak-auth. Using that setup it can authenticate and we get a token back.

The problem we are having now is that the Ember app is served from a different server to the backend and the backend is not responding to OPTIONS requests, so the browser’s CORS/CSP checks are failing. Check just in case this is happening to you too