donny-auth
v1.6.1
Published
A client library for authenticating with the donny-auth system
Downloads
545
Readme
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
})