Authorization

JWT token issue

Wirex Pay Partner API uses JWT tokens for authentication. To obtain a token you need to use client credentials grant flow
To do so you need to make a POST request to the authorization provider with your client id and client secret that you were issued during onboarding process. The request should look like this:

curl --request POST  
 --url https://{authorization_provider_domain}/oauth/token  
 --header 'content-type: application/json'  
 --data '{"client_id":"{your_client_id}","client_secret":"{your_client_secret}","audience":"{api_host_you_want_to_access}","grant_type":"client_credentials"}'

So, for example, if you want to access Wirex Pay Partner Sandbox API, the request should look like this:

curl --request POST  
 --url https://wirex-pay-dev.eu.auth0.com/oauth/token  
 --header 'content-type: application/json'  
 --data '{"client_id":"{your_client_id}","client_secret":"{your_client_secret}","audience":"https://api-business.wirexpaychain.tech","grant_type":"client_credentials"}'

As a result of this request you would receive a response that would look like this:

{  
   "access_token": "{your_access_token}",  
   "token_type": "Bearer",  
   "expires_in": 8640  
 }

You should use this token in the Authorization header of your requests to the API like this:

curl --request GET  
 --url <https://api-business-dev.wirexpaychain.com/api/v1/user>  
 --header 'Authorization: Bearer {your_access_token}'

Performing user specific requests

For all the methods except for Create a new user you need to provide a user identifier in the request.
This API provides you with two ways to identify a user:

Option 1 - By using one of three user filter headers

X-User-Email: User email address filter parameter
X-User-Wallet: User wallet address filter parameter
X-User-Id: User unique identifier filter parameter

  • At least one of these headers should be provided in every request to the API
  • Every request should be authorized using the access token that was obtained using the methods described in the Authorization section
  • Header values will only be considered in case the request to the API is authorized using token obtained using the methods described in the Authorization section, in case the request is authorized using method described in option 2 of this section the values provided in the headers would be disregarded

Option 2 - By using the Authorize User method

  • This method requires you to provide a user identifier and the only way to do it is option 1 from this section
  • This method will return an access token specific to a user, and it should be used in the Authorization header of your requests to the API instead of the token that you would obtain using methods described in the Authorization section
  • To authorize the call to this method you need to provide an access token that was obtained using the methods described in the Authorization section

🚧

Option 1 is recommended for most of the cases, as it provides a more straightforward way to identify a user

📘

Option 2 would be useful in cases when you need to provide a user with a way to access his data without providing him with your client credentials (e.g. you do some of the API requests directly from the client side)