ember.jsember-dataember-simple-auth

Ember simple auth how to update when authenticate data is avaiable


Ember app is using adfs login. when a successful login adfs will redirect to ember web app with a route and query parameters. those query parameters contain

access_token
refresh_token
user_id
scope

i need to update session of the ember auth with those credential data. how can i achieve this ?


Solution

  • You will need to authenticate a session with you params.
    In order to being able to authenticate your session you will need to create an authenticator. Basically, this will provide you some method to being able to handle your session (invalidateSession, authenticate, restoreSession etc..).
    For the authenticator creation check out http://ember-simple-auth.com/api/classes/BaseAuthenticator.html It will look like something like so https://jsfiddle.net/e7nzoa6y/ but that's not exclusive you will have to custom it with you endpoint and stuff

    Then once you have your authenticator, check out the doc at http://ember-simple-auth.com/api/classes/BaseAuthenticator.html

    In your controller, after injecting the session service, you will be able to call the function authenticate with something looking like

    this.session.authenticate(
      'authenticator:YOUR_AUTHENTICATOR', queryParams
    );