Get Access and Refresh Token Using curl

The quickest way to get an access token and a refresh token is to launch your terminal and run the following command:


curl -i -X POST 'https://{{hostname}}/oauth/token' \ 
  -H "authorization: Basic {{base64([clientId]:[clientSecret])}}" \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -d 'grant_type=password&username={{USERNAME}}&password={{PASS}}'

Parameters

There are four parameters in the endpoint URL.

Parameter Value (Sample) Details
{{hostname}} yourcompany.searchunify.com Your instance URL.
{{base64([cilentID]:[clientSecret])}} QzEyZTFm...mMw== Your client ID and client secret concatenated and encoded in Base64.
grant_type=password&username={{USERNAME}} yourname@yourcompany.com The email you use to log into your SearchUnify instance.
grant_type=password&...&password={{PASS}} *********** The password you use to log into your SearchUnify instance.

Generate Access Tokens Repeatedly

Once you have both refresh and access tokens, a more efficient way to generate access tokens repeatedly is to use the call described in Obtain an Access Token from a Refresh Token.

Last updatedTuesday, November 9, 2021

Was this article helpful? Send us your review at help-feedback@searchunify.com