A JS library that supports any website to integrate with DLVR SSO.
- Yarn
- Node version >= 12.2.0
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
.
- 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>
- 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),
});
- 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>
<!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>