How i can tune "Ember Simple Auth" (any other module)?


Hi all,

I’m newbie in emberjs. I want tune module “Ember Simple Auth”. In my environment.js i trying use ENV[‘ember-simple-auth’] object, how it specified in documentation. I can install three properties: authenticationRoute, routeAfterAuthentication, routeIfAlreadyAuthenticated, but i can’t install baseURL. What i can do?



hmm, i dont know what you mean. do you mean register it on initializer? but baseURL is the root of your application, is it the same value in environtment.js, the default one is ‘/’


Thank you for answer! I want use baseURL in authenticator extend from ‘ember-simple-auth/authenticators/base’ for AJAX request.

import Rest from 'ember-simple-auth/authenticators/base';
import Configuration from 'ember-simple-auth/configuration';

init: function() {
        this.baseURL = Configuration.baseURL;

authenticate: function (credentials) {
        var self = this;
        return Ember.$.ajax({
            url: this.baseURL, // this
            method: 'POST',
            data: JSON.stringify(credentials),
            dataType: 'json',
            contentType: 'application/json'


what’s the problem? i still dont clear here, the baseURL’s default value is /, your ajax will POST to ‘/’…


Maybe i wrong understand concept. I trying to set baseURL of module ember-simple-auth, not for all application.

// /config/environment.js
ENV['ember-simple-auth'] = {
        baseURL: '',


you need to configure it on initializer, run ember g initializer ember-simple-auth

import ENV from '../config/environment';
import Configuration from 'ember-simple-auth/configuration';
import setupSession from 'ember-simple-auth/initializers/setup-session';
import setupSessionService from 'ember-simple-auth/initializers/setup-session-service';

export default {
  name: 'ember-simple-auth',
  initialize(registry) {
    const config   = ENV['ember-simple-auth'] || {};
    config.baseURL = ENV.baseURL; //change this whatever value you need


There, you already set up the BaseURL for ESA. However, BaseURL property only used when session invalidated though, not for ajax request :wink: . It used by ESA to redirect to BaseURL when session invalidated occured (say user click sign out) button.


Thank you very much! Now i know how do this :blush: