innotec-auth-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.0.22 • Public • Published

Innotec Auth Plugin

The Innotec-Auth-Plugin is designed to handle all authentication processes for applications where's conntected to the innotec v2 infrastructure. Theses plugin provides different authentication processes:

  • Authentication over authentication providers (Github, PayPal, Facebook ...)
  • Authentication over the Innotec V2 Infrastructure (Authentication by username and password)

With this module its easy to connect the infrastructure.

Installation

NOTE: please use npm 3.* ((sudo) npm i -g npm@3)

npm i --save --save-exact innotec-auth-plugin

Import in your app module

You can import the module in your Application with:

import { InnotecAuthPlugin } from 'innotec-auth-plugin';

Integration Steps

First

At first you must set your personal options of your app. To set this options call the moduleoptions Service:

import { ModuleOptions } from 'innotec-auth-plugin';
 
.
.
 
export class YoUrClAsSs {
  constructor (private options: ModuleOptions) {
 
  }
 
  public yourService() {
    let options = {
      companylogo: "http://yourLogoURL",    // You can define a own logo of your companylogo. Default is the logo of the Innotec Company
      clientid: 'Innotec Client ID',        // Your clientid from Innotec  
      clientsecret: 'Innotec Client Secret',// Your clientsecret from Innotec
      facebook_clientid: 'abc',             // The Facebook Client_ID for OAuth
      google_clientid: 'abc',               // The Google Client_ID for OAuth
      paypal_clientid: 'abc',               // The PayPal Client_ID for OAuth
      endpoint: 'live',                     // Switch for the endpoints. Sandbox is comming soon. live is default.
      userregisterurl: 'url',               // Defines the url where the user can be register... Default is 'https://app.v2.werbasinnotec.com'
      closeable: true                       // Boolen to define if the loginwindow is closeable
    };
 
    this.options.set(options);
  }
}

Second

At next you can import the loginfield in your base template:

<login-field [open]='!isLoggedIn'></login-field>
 

The loginfield is hidden in default-mode. You can open the loginfield with the open property in this element. If the open property true, the login will displayed as fixed container.

Third

To check the loginstate you can call the auth service:

import { CheckAuthStatus } from 'innotec-auth-plugin';
 
export class YoUrClAsSs {
  constructor (private auth: CheckAuthStatus) {
 
  }
 
  public yourService() {
    this.auth.check(); // returns true or false
  }
}
 
 

You can subscribe the variable also:

  this.auth.isLoggedIn().subscribe((state) => {
    this.isLoggedIn = state
  });

Additional functions

CheckAuthStatus:

  • logout(): User will logged out - Cookie will deleted.
  • getTokenInfo(): Will response all tokeninfo. Ex. userobj.picture is users picture

(C) 2017 - Werbas AG / Werbas Innotec GmbH All rights reserverd!

Package Sidebar

Install

npm i innotec-auth-plugin

Weekly Downloads

0

Version

0.0.22

License

MIT

Last publish

Collaborators

  • mwiesmueller