@ovh-ux/ng-ovh-sso-auth

OVH Single Sign On module

Usage no npm install needed!

<script type="module">
  import ovhUxNgOvhSsoAuth from 'https://cdn.skypack.dev/@ovh-ux/ng-ovh-sso-auth';
</script>

README

ng-ovh-sso-auth

OVH $http interceptor working with SSO. Can be used with $resource!

npm version Downloads Dependencies Dev Dependencies

Install

$ yarn add @ovh-ux/ng-ovh-sso-auth

Usage

import angular from 'angular';
import ngOvhSsoAuth from '@ovh-ux/ng-ovh-sso-auth';

angular
  .module('myApp', [ngOvhSsoAuth])
  .config(
    /* @ngInject */ ($httpProvider, constants, ssoAuthenticationProvider) => {
      ssoAuthenticationProvider.setLoginUrl(
        constants.prodMode ? constants.loginUrl : 'auth.html',
      );

      ssoAuthenticationProvider.setLogoutUrl(
        constants.prodMode
          ? '/engine/api/auth/logout'
          : 'api/proxypass/auth/logout',
      );

      ssoAuthenticationProvider.setUserUrl(
        constants.prodMode ? '/engine/api/me' : 'api/user',
      );

      const configuration = [
        {
          serviceType: 'api',
          urlPrefix: 'api',
        },
        {
          serviceType: 'aapi',
          urlPrefix: constants.prodMode ? '../2api-m' : '2api-m',
        },
        {
          serviceType: 'apiv6',
          urlPrefix: 'apiv6',
        },
      ];

      ssoAuthenticationProvider.setConfig(configuration);

      $httpProvider.interceptors.push('OvhSsoAuthInterceptor');
    },
  )
  .run(
    /* @ngInject */ (ssoAuthentication) => {
      ssoAuthentication.login().then(() => {
        // Do what you want after login.
      });
    },
  );

Test

$ yarn test

Related

Contributing

Always feel free to help out! Whether it's filing bugs and feature requests or working on some of the open issues, our contributing guide will help get you started.

License

BSD-3-Clause © OVH SAS