Zoomdata Version

Requesting a Transaction with OAuth 2.0

Once your application has requested and received an access token , it can use the access token to authenticate itself while requesting transactions. The following points illustrate use-cases that require authentication and give sample code to illustrate using the OAuth access token to provide that authentication.

Using a Data Query or Embedding a Chart

To use a data query or to embed a Zoomdata chart in your own web application, you must use Zoomdata's JavaScript client library to create a Zoomdata client. Creating a client requires code like this:

ZoomdataSDK.createClient({
credentials: credentialConfig,
application: applicationConfig
})

Until Zoomdata 2.2, the only possible means of authenticating a client was to use Zoomdata's source-based security key . Starting in version 2.2, Zoomdata allows its security configuration object to contain either a source-based security key or an OAuth access token, but not both. In the example above, the security configuration object is associated with the credentials key using the variable name credentialConfig . The example below shows a security configuration object that uses an OAuth token rather than a Zoomdata security key.

var credentialsConfig = {
access_token: '8615a80b-28c0-4521-930f-5ab6f26d3686'
};

Using curl

You can naturally use curl or the library of your choice to request a transaction using OAuth 2.0. For example:

curl -X GET https :// yourserver/zoomdata /api/ users/123456789 -H "Content-Type: application/vnd.zoomdata.v1+json; Authorization: Bearer ff16372e-38a7-4e29-88c2-1fb92897f558 "

in which

  • https://yourserver/path is the DNS and path for your Zoomdata server, using the correct protocol.
  • users/123456789 is replaced with the method and parameters that you wish to use
  • Authorization parameter contains your own access token

Was this topic helpful?