The SparkBar uses jQuery. If your site also uses jQuery, you can use a lightweight version of the SparkBar that avoids reloading jQuery, which avoids namespace conflicts and code duplication. Simply load this alternative version of the JavaScript after jQuery is loaded:

Step 2: Retrieve a SparkBar token

In order to know who your user is, we need to pass a token along. This token is generated by the SparkBar app itself based on your OAuth session. This way, you're not passing your OAuth credentials in plain view. This token is also only good for the SparkBar, which itself is restricted to only see certain pieces of data (and no writes of any kind).

To receive a SparkBar token, you must POST your OAuth access_token to the SparkBar app on the server side. The URL endpoint is:

https://sparkplatform.com/appbar/authorize

This service expects an access_token parameter, which it will validate against the API. If it's successful, you'll receive:

{ "success": true, "token": YOUR__SPARKBAR__TOKEN__IS__HERE }

If the success attribute has the value true, the value of the token attribute is what you'll need to pass to the SparkBar.init method (detailed in Step 1). If this works, you should see a successfully loaded SparkBar.

However, if the success attribute is false, consult the error attribute for more details about the error. Below is an example response when an invalid or expired access token is POSTed to the appbar service: