import OAuth2ImplicitGrantAuthenticator from 'ember-simple-auth/authenticators/oauth2-implicit-grant';

Authenticator that conforms to OAuth 2 (RFC 6749), specifically the "Implicit Grant Type".

Use OAuth2ImplicitGrantCallbackMixin in your OAuth 2.0 redirect route to parse authentication parameters from location hash string into an object.

Methods

source public

authenticate(hash) Ember.RSVP.Promise

Overrides: authenticate of BaseAuthenticator.

Authenticates the session using the specified location hash (see https://tools.ietf.org/html/rfc6749#section-4.2.2).

If the access token is valid and thus authentication succeeds, a promise that resolves with the access token is returned, otherwise a promise that rejects with the error code as returned by the server is returned (see https://tools.ietf.org/html/rfc6749#section-4.2.2.1).

Arguments

hash: Object

The location hash

Returns

Ember.RSVP.Promise

A promise that when it resolves results in the session becoming authenticated

source public

invalidate( ) Ember.RSVP.Promise

Overrides: invalidate of BaseAuthenticator.

This method simply returns a resolving promise.

Returns

Ember.RSVP.Promise

A promise that when it resolves results in the session being invalidated

source public

restore(data) Ember.RSVP.Promise

Overrides: restore of BaseAuthenticator.

Restores the session from a session data object; will return a resolving promise when there is a non-empty access_token in the session data and a rejecting promise otherwise.

Arguments

data: Object

The data to restore the session from

Returns

Ember.RSVP.Promise

A promise that when it resolves results in the session becoming or remaining authenticated

Events

source

sessionDataInvalidated

Inherited from: sessionDataInvalidated of BaseAuthenticator.

Triggered when the authentication data is invalidated by the authenticator due to an external or scheduled event. This might happen, e.g., if a token expires or an event is triggered from an external authentication provider that the authenticator uses. The session handles the event and will invalidate itself when it is triggered.

source

sessionDataUpdated

Inherited from: sessionDataUpdated of BaseAuthenticator.

Triggered when the authentication data is updated by the authenticator due to an external or scheduled event. This might happen, e.g., if the authenticator refreshes an expired token or an event is triggered from an external authentication provider that the authenticator uses. The session handles that event, passes the updated data back to the authenticator's restore method and handles the result of that invocation accordingly.

Arguments

data: Object

The updated session data