Coder Social home page Coder Social logo

aaas-auth-demo's Introduction

AAAS JavaScript Authentication SDK

Installation

This is a laravel php project.

run composer install to install some dependencies.

Make the following folders writeable bootstrap storage

setup an nginx or apache server to the public folder

Use Cases

When a user is a member

/user_member

When a user is not a member

/user_not_member

When a user is an author

/user_author

Usage

The JS SDK can be found in the public/sdk folder.

Data attributes should be added to the elements that when clicked, will trigger the authentication process.

The SDK should be initialized with a redirect url.

When the user clicks on the element, a popup window opens and the user begins the authentication process.

After a successful authentication, the pop up closes and the user is redirected to the redirect url that was supplied during the initialization of the SDK.

A JWT containing the user's email, ISBN number and the selected author will be passed as a query parameter to the supplied redirect url as in the example below.

https://rightsplatform.com/articles?data=eyJhbGc...VCJ9.eyJzdW...IyfQ.SflK...sw5c

Example

<!--include data attributes on the links to be clicked by the user-->
<li data-aaas data-isbn="978-3-16-148410-0">
    <a href="">Request Permission</a>
</li>

<!-- include sdk in the client's page-->
<script type="text/javascript" src="path/to/authsdk.js"></script>
<script type="text/javascript">

    // url to be redirected to after a successful authentication
    let redirectUrl = 'https://rightsplatform.com/articles'
    
    // initialize the sdk
    AuthSDK.setupLinks(redirectUrl)
</script>

aaas-auth-demo's People

Contributors

supardyke avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.