Widgetic API
Client Library for theThis is a JavaScript client library for the Widgetic API, written in CoffeeScript, suitable for use in most browsers.
Installation
In the browser
This library is available at https://widgetic.com/sdk/sdk.js
so add the following script
tag in the head
section of your page:
Usage
The documentation is available on the Widgetic Documentation website.
The library exposes a global Widgetic
variable that you can use to interact with the SDK's functions.
The first step is to initialize the SDK with your Widgetic app_id and redirect_url:
Widgetic;
After this step you can login using the Widgetic.auth()
function.
You can pass a Boolean
parameter that indicates if a popup should be opened or you just want to check if user is logged in. Default will open popup.
This has promise support built-in using the aye library.
//Check if user is logged inWidgetic;//Open popup to login userWidgetic;
After user is logged in you call the Widgetic API using Widgetic.api(url,method,data)
.
This function returns a promise.
For example if you want to grab user info:
Widgetic;