ID Mobile — Generate an access token

Support DQE
Support DQE
  • Updated
Access Token - ID Mobile API

Use this endpoint to generate an IDMobile access token. The token is required to call all other IDMobile scope endpoints.

Related ID Mobile documentation:

access_token

Request

Both GET and POST are supported.

{SERVER_ADDRESS} and {LICENCE_CODE} are provided by DQE upon account creation. Contact your DQE account manager to obtain these credentials.
GEThttps://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret={CLIENT_SECRET}&grant_type=client_idmobile&licence={LICENCE_CODE}

Code examples

Request an IDMobile access token

curl "https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret={CLIENT_SECRET}&grant_type=client_idmobile&licence={LICENCE_CODE}"
fetch("https://{SERVER_ADDRESS}/ACCESS_TOKEN/?" + new URLSearchParams({ client_secret: "{CLIENT_SECRET}", grant_type: "client_idmobile", licence: "{LICENCE_CODE}" })) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.get( "https://{SERVER_ADDRESS}/ACCESS_TOKEN/", params={ "client_secret": "{CLIENT_SECRET}", "grant_type": "client_idmobile", "licence": "{LICENCE_CODE}", }, ) print(response.json())
<?php $params = http_build_query([ 'client_secret' => '{CLIENT_SECRET}', 'grant_type' => 'client_idmobile', 'licence' => '{LICENCE_CODE}', ]); $ch = curl_init("https://{SERVER_ADDRESS}/ACCESS_TOKEN/?{$params}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
const axios = require('axios'); axios.get('https://{SERVER_ADDRESS}/ACCESS_TOKEN/', { params: { client_secret: '{CLIENT_SECRET}', grant_type: 'client_idmobile', licence: '{LICENCE_CODE}' } }) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String url = "https://{SERVER_ADDRESS}/ACCESS_TOKEN/" + "?client_secret={CLIENT_SECRET}&grant_type=client_idmobile&licence={LICENCE_CODE}"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .GET() .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());
using var client = new HttpClient(); var url = "https://{SERVER_ADDRESS}/ACCESS_TOKEN/" + "?client_secret={CLIENT_SECRET}&grant_type=client_idmobile&licence={LICENCE_CODE}"; var response = await client.GetAsync(url); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);
package main import ( "fmt" "io" "net/http" ) func main() { url := "https://{SERVER_ADDRESS}/ACCESS_TOKEN/" + "?client_secret={CLIENT_SECRET}&grant_type=client_idmobile&licence={LICENCE_CODE}" resp, err := http.Get(url) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }
POSThttps://{SERVER_ADDRESS}/ACCESS_TOKEN/

Add the following parameters in the request body using Content-Type: application/x-www-form-urlencoded.

Code examples

Request an IDMobile access token

curl -X POST "https://{SERVER_ADDRESS}/ACCESS_TOKEN/" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "licence={LICENCE_CODE}" \ -d "client_secret={CLIENT_SECRET}" \ -d "grant_type=client_idmobile"
fetch("https://{SERVER_ADDRESS}/ACCESS_TOKEN/", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ licence: "{LICENCE_CODE}", client_secret: "{CLIENT_SECRET}", grant_type: "client_idmobile" }) }) .then(r => r.json()) .then(data => console.log(data));
import requests response = requests.post( "https://{SERVER_ADDRESS}/ACCESS_TOKEN/", data={ "licence": "{LICENCE_CODE}", "client_secret": "{CLIENT_SECRET}", "grant_type": "client_idmobile", }, ) print(response.json())
<?php $ch = curl_init("https://{SERVER_ADDRESS}/ACCESS_TOKEN/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ 'licence' => '{LICENCE_CODE}', 'client_secret' => '{CLIENT_SECRET}', 'grant_type' => 'client_idmobile', ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
const axios = require('axios'); const qs = require('querystring'); axios.post('https://{SERVER_ADDRESS}/ACCESS_TOKEN/', qs.stringify({ licence: '{LICENCE_CODE}', client_secret: '{CLIENT_SECRET}', grant_type: 'client_idmobile' })) .then(response => console.log(response.data));
HttpClient client = HttpClient.newHttpClient(); String form = "licence={LICENCE_CODE}&client_secret={CLIENT_SECRET}&grant_type=client_idmobile"; HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://{SERVER_ADDRESS}/ACCESS_TOKEN/")) .header("Content-Type", "application/x-www-form-urlencoded") .POST(HttpRequest.BodyPublishers.ofString(form)) .build(); HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body());
using var client = new HttpClient(); var form = new Dictionary<string, string> { ["licence"] = "{LICENCE_CODE}", ["client_secret"] = "{CLIENT_SECRET}", ["grant_type"] = "client_idmobile" }; var response = await client.PostAsync( "https://{SERVER_ADDRESS}/ACCESS_TOKEN/", new FormUrlEncodedContent(form)); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);
package main import ( "fmt" "io" "net/http" "net/url" ) func main() { form := url.Values{} form.Set("licence", "{LICENCE_CODE}") form.Set("client_secret", "{CLIENT_SECRET}") form.Set("grant_type", "client_idmobile") resp, err := http.PostForm("https://{SERVER_ADDRESS}/ACCESS_TOKEN/", form) if err != nil { panic(err) } defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }

Parameters

Parameter Description Mand / Opt
SERVER_ADDRESS Address of the DQE server that will process the data. Mandatory
licence Number assigned to you as your licence code. Mandatory
client_secret Passphrase provided by the customer. Mandatory
grant_type Static value. Must be client_idmobile.
Fixed value: client_idmobile
Mandatory

Response

The API returns a JSON object containing the following keys.

Key Description Type
access_token Temporary token used to call IDMobile services. String
token_type Bearer: the authorised token type. String
expires_in Token validity period, in seconds. String
refresh_token Token used to extend your session. String

Response example

Example token response
{ "access_token": "TK948869a6f873adb622enhoaGeVY2iRaptqlmpplGeWZA", "token_type": "Bearer", "expires_in": "300", "refresh_token": "*TK9bdd05f8e9d3c905834bdeqaUlGFll2iRaplll29mZmtkZQ" }

Errors

Error type Example request Response
Missing licence parameter https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret={CLIENT_SECRET}&grant_type=client_idmobile 400 Invalid Request
Empty licence parameter https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret={CLIENT_SECRET}&grant_type=client_idmobile&licence= 400 Invalid Request
Incorrect licence value https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret={CLIENT_SECRET}&grant_type=client_idmobile&licence={INCORRECT_LICENCE_CODE} 400 Invalid Client
Missing or empty client_secret parameter https://{SERVER_ADDRESS}/ACCESS_TOKEN/?grant_type=client_idmobile&licence={LICENCE_CODE}
https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret=&grant_type=client_idmobile&licence={LICENCE_CODE}
400 Invalid Request
Missing or incorrect grant_type parameter https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret={CLIENT_SECRET}&licence={LICENCE_CODE}
https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_secret={CLIENT_SECRET}&grant_type=wrong_value&licence={LICENCE_CODE}
400 Invalid Request
Parameter typo https://{SERVER_ADDRESS}/ACCESS_TOKEN/?client_scret={CLIENT_SECRET}&grant_type=client_idmobile&licence={LICENCE_CODE} 500 Internal Server Error

Test the API

Click the button below to test this endpoint live in your browser.

Open console

See also

Was this article helpful?

0 out of 0 found this helpful