ado-ng-auth

1.2.8 • Public • Published

Usage

Set the environment variables in your angular application:

(function () {
  'use strict';
 
  angular.module('YourApp')
    .config(['envServiceProvider', 'adoAuthConfig', function(envServiceProvider, adoAuthConfig) {
      // set the domains and variables for each environment
      envServiceProvider.config({
        domains: {
          development: ['localhost', '127.0.0.1'],
          production: ['*.yourdmain.com'],
          //test: ['test.acme.com', 'acme.dev.test', 'acme.*.com'],
          // anotherStage: ['domain1', 'domain2']
        },
        vars: {
          development: {
            prod: false,
            apiBaseUrl: 'http://localhost:8000',
            recaptcha_public_key: '6LcjW28UAAAAADaLbROztkzHAqPTzmFhtwVwNiVu'
          },
          production: {
            prod: true,
            apiBaseUrl: 'https://adopisowifi.herokuapp.com',
            recaptcha_public_key: '6LchBGYUAAAAANWc6a-Xp6hkptv9alGEQNVY1vPQ'
          },
          // anotherStage: {
          //  customVar: 'lorem',
          //  customVar: 'ipsum'
          // },
          defaults: {
            prod: false,
            apiBaseUrl: 'https://localhost:8000',
          }
        }
      });
 
      envServiceProvider.check();
 
      // default config
      var defaultConfig = {
        cors: true,
        loginSuccessRedirectState: 'dashboard.home',           // where to redirect after successfull login
        registrationPath: '#!/register',                  // where to redirect after account confirmation
        unauthorizedEventName: 'ado:auth:401'
      };
 
      adoAuthConfig.set(defaultConfig);
 
      // run the environment check, so the comprobation is made
      // before controllers and services are built
    }]);
 
})();
 

Readme

Keywords

Package Sidebar

Install

npm i ado-ng-auth

Weekly Downloads

0

Version

1.2.8

License

ISC

Unpacked Size

196 kB

Total Files

25

Last publish

Collaborators

  • adonesp