Requesting an Access Token
After you have registered an application as an OAuth client with a particular Zoomdata server and provided the client ID to the client, the client application can request permission from the Zoomdata server to access a user's resources by requesting an access token. Before the Zoomdata server will serve the request, the user must specifically authorize it to do so using Zoomdata's login screen. When the user has authorized the server to serve resources to the client, the server will grant the client an access token. Your client can request an access token using the following steps.
To request an access token from a Zoomdata server:
yourserver /zoomdata/oauth/authorize?client_id= 123 &redirect_uri= https://www.yourapp.com &response_type=token&scope=readWhere:
yourserveris replaced with your server's DNS or IP address, together with any necessary port number
123is replaced with your app's registered clientId
https://www.yourapp.comis replaced with the URI (with correct protocol) to which Zoomdata should redirect the browser upon successful login/authorization by the user.As part of the OAuth 2.0 protocol, Zoomdata will only redirect the user's browser to a URI included in the
registeredRedirectURIslist provided to Zoomdata when the client is registered.
redirect_urithat you specified in the GET call above. The full URI to which the user's browser is redirected includes a parameter called
access_token. For example:www.yourapp.com/#access_token=2ea7e479-0e4f-4720-9f74-e4465be9933b&token_type=bearer&expires_in=600
In your application on the page receiving the redirect, extract the
access_tokenparameter from the URI that loaded the page.Popular sites like Stack Overflow can provide guidance on how to extract parameters from the URI used to query a page. For example, see https://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js.
After you have extracted the access token, your application can use it to request a transaction .
Was this topic helpful?