0.0.6 • Published 2 years ago

deliveree_auth_popup v0.0.6

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Deliveree Auth Popup

A JS library that supports any website to integrate with DLVR SSO.

Prerequisites

  • Yarn
  • Node version >= 12.2.0

Installation

Local development

git clone https://acemt@bitbucket.org/inspireventures/deliveree_auth_popup.git
yarn
yarn build:dev
yarn dev
  • Then open http://localhost:3000/ to see your app.
  • When you’re ready to deploy to production, create a minified bundle with yarn build.

Getting Started

Step 1: Load the Deliveree Auth Popup

  • You must include the script on your web pages that integrate Deliveree Auth Popup.
<script type="module" src="./dist/deliveree-auth-popup.umd.js" async defer></script>

Step 2: Initialize the Deliveree Auth Popup

  • There are 4 required options for every popup: clientId, clientSecret, onSuccess and onFailure.
DelivereeAuth.init({
  clientId: 'YOUR_CLIENT_ID',
  clientSecret: 'YOUR_SECRET_ID',
  onSuccess: (token) => console.log(token),
  onFailure: (error) => console.log(error),
});

Step 3: Add a sign in button

  • Display a sign in button in your web pages to open the popup and make sure that the button's class has to be deliveree_signin.
<button class="deliveree_signin">Sign in</button>

Full Example

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Deliveree</title>
    <script src="./dist/deliveree-auth-popup.umd.js" async defer></script>
  </head>
  <body>
    <button class="deliveree_signin">Sign in</button>
  </body>
  <script>
    window.onload = () => {
      DelivereeAuth.init({
        clientId: 'YOUR_CLIENT_ID',
        clientSecret: 'YOUR_SECRET_ID',
        onSuccess,
        onFailure,
      });
      
      function onSuccess(token) {
        alert('client success');
      }

      function onFailure(error) {
        alert('client failure');
      }
    };
  </script>
</html>
0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago