npm.io
1.8.0 • Published 3 years ago

@myvalue/sso

Licence
ISC
Version
1.8.0
Deps
0
Size
13 kB
Vulns
0
Weekly
0

MyValue SSO Web

MyValue SSO Web is a library that is used to make it easier for you to use single sign on from myvalue

Usage

Using NPM or Yarn

  • Install library using npm or yarn

    $ npm install @myvalue/sso
    or 
    $ yarn add @myvalue/sso
    
  • Import library by using the steps as below

    // Import Library
    const $myvalue = require('@myvalue/sso')
    
    // Init client instance
    $myvalue.init({
      app: '<your_app_name>',
      clientID: '<your_myvalue_client_id>',
      state: '<your_state>',
      redirectUri: '<your_redirectUri>,
      seamless: {
          show: true || false, // by default is false,
          isLogin: true || false, // by default is false,
      },
      chooseAccount: {
          show: true || false, // by default is false,
      },
      environment: 'development' || 'production' // by default is production 
    });
    
    // Call MyValue SSO Login Page
    $myvalue.login()
    
    // Call MyValue SSO Register Page
    $myvalue.register()
    
  • Import library and usage library with import function

    // Import library
    import { init, login, register } from '@myvalue/sso'
    
    // Init client instance
    init({
      app: '<your_app_name>',
      clientID: '<your_myvalue_client_id>',
      state: '<your_state>',
      redirectUri: '<your_redirectUri>,
      seamless: {
          show: true || false, // by default is false,
          isLogin: true || false, // by default is false,
      },
      chooseAccount: {
          show: true || false, // by default is false,
      },
      environment: 'development' || 'production' // by default is production 
    });
    
    // Call MyValue SSO Login Page
    login()
    
    // Call MyValue SSO Register Page
    register()
Using Script Tag
  • Import Script JS

    <script src="https://unpkg.com/@myvalue/sso@latest/dist/myvalue-sso.js" async defer></script>
    
  • Create client instance and Usage Library

    // Init Client Instance
    window.onload = function () {
      $myvalue.init({
          app: '<your_app_name>',
          clientID: '<your_myvalue_client_id>',
          state: '<your_state>',
          redirectUri: '<your_redirectUri>',
          seamless: {
              show: true || false, // by default is false,
              isLogin: true || false, // by default is false,
          },
          chooseAccount: {
              show: true || false, // by default is false,
          },
          environment: 'development' || 'production' // by default is production 
      });
    };
    
    // Call MyValue SSO Login Page
    $myvalue.login()
    
    // Call MyValue SSO Register Page
    $myvalue.register()

List Parameter for init client instance

Params Type Description
app String Name your application
clientID String ClientID SSO MyValue
state String State SSO MyValue
redirectUri String Redirect uri your application
seamless.show Boolean To enable myvalue seamless login feature
seamless.isLogin Boolean To set the conditions if you don't want to show a seamless login pop up when you're logged in
chooseAccount.show Boolean To enable myvalue choose account login feature
environment Enum (development / production) To set the environment you want to use in sso myvalue