Question

Sandbox API Testing

  • 24 August 2023
  • 8 replies
  • 92 views

Can the sandbox API be tested on a application? When I send a call to the requesttopay endpoint I get a server error. Secondly collection widget display but doesn’t work and when I tried to create Oauth 2.0 token I get Authorized as status code and error of “invalid client”.

 

I also want to know how I can place the API user key and API key on the authorization field after encoding to base64.


8 replies

Userlevel 2

Yes.
It can be tested, the difference is you dont receive any sms prompts, but rather use status and responses from the endpoint to decide the next callto action

Depends on which programming environment. All those errors you are getting is because of invalid authentication.

1- Username should be your x-reference-Id 

2- Password should be your generated api-key from POST:... API key

 

All platforms PHP, Java, JavaScript, Python have libraries for Auth credentials..... Just create a type definition like

 

typeDef token = Credential(username, password);

 

//Implement that for whatever language or framework

hey @Harold Rwothomio, this answers my question about the id. Thank you!

Depends on which programming environment. All those errors you are getting is because of invalid authentication.

1- Username should be your x-reference-Id 

2- Password should be your generated api-key from POST:... API key

 

All platforms PHP, Java, JavaScript, Python have libraries for Auth credentials..... Just create a type definition like

 

typeDef token = Credential(username, password);

 

//Implement that for whatever language or framework

grant_type=urn:openid:params:grant-type:ciba&auth_req_id={auth_req_id}

Good day how do you get and use the auth_req_id

The Authentication token is generated by passing both username(x-reference-id) and password (sandbox provisioned API_key) in a 64Base encoded format.

Taking an example in Java, there's a java.utils package that has Base64 encoding utility class. Javascript, Php, python also have this type of utility function in libraries.

For Java( which may be done similarly to other programming languages) create an object from the Base64 encoding and use it to generate username and password from the two strings x-reference-id and API_key.

 

Then create AuthCredential credential= AuthCredential (username, password);

Use that credential in your POST request and you will be able to generate your Bearer token.

The Authentication token is generated by passing both username(x-reference-id) and password (sandbox provisioned API_key) in a 64Base encoded format.

Taking an example in Java, there's a java.utils package that has Base64 encoding utility class. Javascript, Php, python also have this type of utility function in libraries.

For Java( which may be done similarly to other programming languages) create an object from the Base64 encoding and use it to generate username and password from the two strings x-reference-id and API_key.

 

Then create AuthCredential credential= AuthCredential (username, password);

Use that credential in your POST request and you will be able to generate your Bearer token.

Thank you so much for the response, this I have done, my question what goes in to the request body I keep getting     "error": "invalid_request". 

 

 

Use JSON as the request of the body. "application/json" for the type

 

 

Tried it 

Use JSON as the request of the body. "application/json" for the type

 

 


do you have a example export, 

Reply