donny-auth

1.6.1 • 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
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.6.1
    200
    • latest

Version History

Package Sidebar

Install

npm i donny-auth

Weekly Downloads

204

Version

1.6.1

License

UNLICENSED

Unpacked Size

90.4 kB

Total Files

7

Last publish

Collaborators

  • brandwatch
  • spmason
  • chrisskilton