Created
March 16, 2016 16:00
-
-
Save hedleysmith/8088373ca9dcf31e472f to your computer and use it in GitHub Desktop.
Anvil Connect: Node client basic re-usable config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const configureAnvil = function() { | |
return anvil.discover() | |
.then(function (configuration) { | |
return anvil.getJWKs(); | |
}, | |
function(err) { | |
console.log(err); | |
}) | |
.then(function (jwks) { | |
// To redirect to the registration page instead of signup page use this: | |
// return anvil.authorizationUri({ | |
// endpoint: 'signup' | |
// }); | |
return anvil.authorizationUri(); | |
}, | |
function(err) { | |
console.log(err); | |
}); | |
}; | |
// Elsewhere in your app... | |
configureAnvil() | |
.then(function (uri) { | |
res.redirect(uri); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment