@ovh-ux/ng-ovh-sso-auth
v4.8.1
Published
OVH Single Sign On module
Downloads
74
Readme
ng-ovh-sso-auth
OVH $http interceptor working with SSO. Can be used with $resource!
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
- @ovh-ux/ng-ovh-sso-auth-modal-plugin - OVH SSO module - Modal plugin
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