Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

donny-auth

1.5.6 • Public • Published

donny-auth

A client library for authenticating with the donny-auth system

install

yarn add donny-auth

usage

const TokenStore = require('donny-auth')
 
// the source needs to be an html page
const store = new TokenStore('https://auth-store')
 
store.getToken({
    aud: 'audience'
}).then(function (token) {
    if (!token) {
        // redirect to `store.loginUrl`
    }
    // do stuff with token
}, function (err) {
    // probably means you're not allowed to use donny-auth on this domain
})
 
// if you have an API2 token
store.upgradeToken({
    aud: 'audience',
    api2_token: 'your-api2-token'
}).then(function (token) {
    if (!token) {
        // redirect to `store.loginUrl`
    }
    // do stuff with token
}, function (err) {
    // probably means you're not allowed to use donny-auth on this domain
})

Keywords

none

install

npm i donny-auth

Downloadsweekly downloads

115

version

1.5.6

license

UNLICENSED

last publish

collaborators

  • avatar
  • avatar
  • avatar
Report a vulnerability