1.1.1 • Published 7 years ago

hiro-graph-implicit-oauth v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

hiro-graph-implicit-oauth: Implicit OAuth flow helper

A simple oauth implicit flow, with options for a Popup or a Redirect based

installation

$ npm install hiro-graph-implicit-oauth

Usage example

import { Popup } from "hiro-graph-implicit-oauth"

const config = {
    url: "https://your/authorize/url...",
    clientId: "...yourClientId"
};

// Your login button
const loginButton = document.getElementById("loginButton")

const { check, request } = Popup(config);

const authCallback = (err, token) => {
    if (err) {
        //something bad happened :(
        console.warn(err);
    }
    if (token) {
        // User logged in successfully
        // access token at `token.accessToken`
        // metadata at `token.meta`
        document.write("Logged In: " + token.accessToken);
    }
});

//perform passive login check
check(authCallback);

// Trigger implicitOauth when clicked (open popup)
loginButton.addEventListener("click", () => request(authCallback));
1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.7

8 years ago

0.2.6

8 years ago

0.2.5

8 years ago

0.2.2

8 years ago

0.2.0

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.0

8 years ago

0.0.4-0

8 years ago

0.0.3-0

8 years ago