Objective
How to generate Jumper.AI token using OAuth 2.0 to use the Jumper APIs for your Jumper account.
Applies To
- Jumper
- Token Generation & Re-generation
Procedure
Prerequisites:
- Registered Jumper Developer account
- Jumper Merchant account
Steps:
- Register for a Jumper Developer account here using the same email ID for your Jumper Merchant account.
- Log in to Jumper Developer portal using the registered Jumper Merchant account.
- Create an application in the Jumper Developer portal and ensure that OAuth API is enabled for the application. You may refer to here for the detailed steps to create an application in the Jumper Developer portal.
-
Note down the Key, Secret, and
callback URL of the created application.
- Log in to Jumper.AI portal using your merchant login and password.
-
Copy and paste the following URL in the address bar of your web browser and
replace the client_id with the Key and
redirect_uri with the callback URL of your
application:
https://api.jumper.ai/oauth/login?client_id={key}&scope=order&response_type=code&redirect_uri={callback_url}
-
You will be redirected to a page to confirm the scope(s) of the Jumper APIs
to use. Click on Confirm to authorise the app with the Jumper
Merchant and proceed.
-
Once authorized, you will be redirected to a page with error code and similar
following URL:
https://jumper.ai/oauth-prod-test-result?code=YmQYczJe&response_type =code&scope=order&merchant_id=6316123203031552
- Note down the code and merchant_id in the URL, as they are required to generate the token.
- Replace the values of the parameters for the following cURL command and import into Postman. The tokens will be generated once you complete the Postman command.
-
On Postman please make sure you have the ‘x-www-form-urlencoded’ selected
in order to avoid the 404 error and create the access token.
Unset
curl --location 'https://api.jumper.ai/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'code={code}' \
--data-urlencode 'client_id={key}' \
--data-urlencode 'client_secret={secret}' \
--data-urlencode 'redirect_uri={redirect_uri}' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'merchant_id={merchant_id}' -
An example of the response is as follows:
Unset
{
"access_token":
"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJsdnlFYkpCNW5SNWJZZGZscnJ4VnYzc
TNnR09IIiwdgAPltqd7_lyo33aZIatFju2QsYgCcEkEfUqBg88wy9XyGWnUl_59J7r-tu9pZg",
"refresh_token":
"eyJ0eXAiOiJKV1QiLCJhbGciOikXHkRuNUzeGIYXjBR19Hmig6zHEyIqF6Ch8f8FjEyw0nXKsLrR_D
nINYIRrH1DVpevhAe3Npw6KW9tM3r_na5QpXTP36uyrsju_02h7tOtRS9zg4Qpfbwqn2ef05l4NY379
a3DXFJiEEA",
"expires_in": "2591999"
}