Wrapper for the Divshot API.
npm install divshot-api --save
bower install divshot --save
Refer to the Narrator api for a more in depth understanding of all available methods.
var Divshot = ;
var api = Divshot;
The Divshot API wrapper provides a simple, popup-based authentication mechanism for
easily authenticating a user without requiring the handling of usernames or passwords.
To use browser authentication, simply instantiate a client and call the
divshot.auth(type, options, callback)
This method returns a promise but takes an optional callback.
type should be either
github (defaults to
var api = Divshot;divshot;
If you need to accept an email and password directly, you can do so as in the following example. Passwords MUST NOT be stored and should only come from direct user input (e.g. a form field).
For convenience, the
auth method allows you to store a cookie with an encoded access token
to keep the user logged into Divshot. Simply pass the
store: true option to
This will automatically create a cookie on the current domain to store the access token for one
week. On subsequent page loads you can use the
authWithCookie() method to authenticate a client
based on the cookie. This method will return
true if a cookie was found and
if api// cookie found, api is now authenticated and can// make calls to retrieve protected resourceselse// no cookie found, display an auth button etc
Custom XHR arguments can be set to be sent with each request. Refer to Angular's $http documentation for which arguments are supported.
By default, the
authenticate method will be called on each request as a pre hook. If a token is provided, this does not create another http request.
apiuser;apiuser;// User dataapiuserself;// ORapiuseriduserId;// Update uservar user = apiuseriduserId;user;// Set welcomed for new usersapiuser;// Delete accountapiuser;
// Change passworddivshotuserpassword;// Reset password if forgottendivshotpassword;
// Add emaildivshotuseremails;// Set primary emaildivshotuseremails;// Remove emaildivshotuseremails;// Resend emaildivshotuseremails;
// Users orgsdivshotorganizations;// A single organizationdivshotorganizationsidsomeOrgId;// Apps from an organizationdivshotorganizationsidsomeOrgIdapps;// Create organizationdivshotorganizations;// Update organizationdivshotorganizationsidsomeOrgId;
// Get org membersdivshotorganizationsidsomeOrgmembers;// Invite members to organizationdivshotorganizationsidsomeOrgmembers;// Update a member in organiztiondivshotorganizationsidsomeOrgmembersidmemberid;// Remove a member from an organizationdivshotorganizationsidsomeOrgmembersidmemberId;
// List appsapiapps;// Create an appapiapps;// Create an app from objectapiapps;// A specific appvar app = apiappsid'app name';app;// Delete an appapp;
appbuilds;appbuildsid'build id';appbuildsid'build id';appbuildsid'build id';
appreleases;appreleases;appreleases;// Rollback to specific versionappreleases;appreleases;
// List domains for an appappdomains;// Add a domainappdomains;// Remove a domainappdomains;
Update data associated with an App's subscription
Manipulate webhooks associated with your app