Error when using torii with ember-simple-auth


Hi guys,

Trying to learn ember and more specifically how ember implements oauth2, e.g. (‘Sign in with X’) functionality.

I’ve played around with ember-simple-auth, torii, and ember-oauth2.

My current attempt is to implement a ‘Sign in with Slack’ button on my login page. I’ve followed the documentation on how a torii provider should be set up. The resulting code appears as follows in my config/environment.js file:

var ENV = {
    torii: {
      providers: {
        'slack': {
          clientId: "28748355378.284728941425",
          authBaseUri: '',
          redirectUri: 'https://localhost:4200/app/search',
          scope: 'channels:read'

I’ve implemented the steps shown here for my authenticators/torii.js file, which results in the following:

import Ember from 'ember';
import ToriiAuthenticator from 'ember-simple-auth/authenticators/torii';
import Torii from 'ember-simple-auth/authenticators/torii';

const { service } = Ember.inject;

export default Torii.extend({
  torii: service('torii'),
  authenticate(options) {
    return this._super(...arguments).then(function(data) {
      alert(`authorizationCode:\n${data.authorizationCode}\nprovider: ${data.provider}\nredirectUri: ${data.redirectUri}`);

My login route looks like this:

import Ember from 'ember';

export default Ember.Route.extend({
  emberOauth2: Ember.inject.service(),
  session: Ember.inject.service('session'),

  actions: {
    authenticate() {
      this.get('session').authenticate('authenticator:torii', 'slack');
    invalidateSession() {

My sign in with Slack button looks like this:

<a {{action "authenticate"}}
  <img alt="Sign in with Slack" height="40" width="172" src="" srcset=" 1x, 2x"/>

However, when I click on the ‘Sign in with Slack’ button, my console shows the following error:

Error: Expected a provider named 'slack' , did you forget to register it?

As far as I can tell, I have registered it correctly in my config/environment.js file. Can someone help me understand what I’m missing here?

Also, an explanation of what needs to be in the redirectURI to properly handle the returned token would also be very helpful.



I ended up using default torii style:


import Oauth2 from 'torii/providers/oauth2-code';

export default Oauth2.extend({
  name:       'slack-oauth2',
  baseUrl:    '',
  redirectUri: 'http://localhost:4200/auth/sign_in_with_slack/callback',
  responseParams: ['code', 'state']

Note: My provider was named slack-oauth2, not slack.