Class

ToriiAuthenticator

ToriiAuthenticator()

Constructor

# new ToriiAuthenticator()

Authenticator that wraps the Torii library and thus allows to connect any external authentication provider that torii defines a provider for.

In order to use this authenticator, the application needs to have the torii addon installed and must inject the torii service into the authenticator:

// app/authenticators/torii.js
import Torii from 'ember-simple-auth/authenticators/torii';
import { inject as service } from '@ember/service';

export default class ToriiAuthenticator extends Torii {
  @service torii;
}
Deprecated:
  • Implement an authenticator that wraps Torii in application code instead: since 4.2.0

View Source authenticators/torii.js, line 15

Extends

Methods

# static authenticate(provider, options) → {Ember.RSVP.Promise}

Authenticates the session by opening the specified torii provider. For more documentation on torii and its providers abstraction, see the project's README, specifically the section on providers.

Parameters:
Name Type Description
provider String

The torii provider to authenticate the session with

options Object

The options to pass to the torii provider

View Source authenticators/torii.js, line 90

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

Ember.RSVP.Promise

# static invalidate() → {Ember.RSVP.Promise}

Closes the torii provider. If the provider is successfully closed, this method returns a resolving promise, otherwise it will return a rejecting promise, thus intercepting session invalidation.

View Source authenticators/torii.js, line 115

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

Ember.RSVP.Promise

# static restore(data) → {Ember.RSVP.Promise}

Restores the session by calling the torii provider's fetch method.

__Many torii providers do not implement the `fetch` method__. If the
provider in use does not implement the method simply add it as follows:

```js
// app/torii-providers/facebook.js
import FacebookOauth2Provider from 'torii/providers/facebook-oauth2';

export default class FacebookToriiProvider extends FacebookOauth2Provider {
  fetch(data) {
    return data;
  }
}
```
Parameters:
Name Type Description
data Object

The data to restore the session from

View Source authenticators/torii.js, line 42

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

Ember.RSVP.Promise