Breadfish OAuth
A simple library to use the Breadfish OAuth API in NodeJS.
Table of Contents
Installation
npm install breadfish-oauth
Usage
const BreadfishOAuth = ;
Or if you want to use it with ES6:
;
Example
const BreadfishOAuth = ;let oauth = "PROJECT_ID" "API_KEY";
Full example
// Always use try/catch when you use the library!// Many of the functions can throw an error when you pass something invalid.try let oauth = "PROJECT_ID" "API_KEY"; // Creates a new oAuth instance (throws an error if the credentials are invalid) // Verifies the credentials. This is not required, but is advised, // because the generated Auth URL will not work if the credentials are wrong await oauth; // Scopes let valid = BreadfishOAuth; // Checks if the specified scope is valid (Returns boolean) let availableScopes = BreadfishOAuth; // All available scopes in an array of strings oauth; // Sets an array of strings as the available scopes oauth; // Removes the specified scope oauth; // Removes all scopes oauth; // Adds a single scope // Redirect oauth; // Sets the redirect url (has to match the domain in the project settings) // Getters (These don't have setters! Use the functions to set them) let scopes = oauthscopes; let redirectURL = oauthredirectURL; // Generate the Authentification URL let url = oauth; // Generates the auth url (Throws an error if the scopes are not set, or there is no redirect url set) catch e console;
Support
Please open an issue for support.
License
MIT © Leon B.