question

kesha avatar image
kesha asked ·

Not able to access merchant data with oauth generated api_token

I am trying to get api_token for my clover sandbox account using steps oauth2.0 but not able to access merchant data with this api_token. I have created an webapp in sandbox developer account and created merchant in sandbox dashboard.
Steps followed :
1) Req : https://sandbox.dev.clover.com/oauth/authorize?client_id={client_id}&redirect_uri=http://localhost:8080
Resp : http://localhost:8080/?merchant_id={merchant_id}&employee_id={employee_id}&client_id={client_id}&code={code}

2) Req : https://sandbox.dev.clover.com/oauth/token?client_id={client_id}&client_secret={client_secret}&code={code}
Resp : {"access_token":"45856b21-6e33-9d50-5cb7-ffca904c360b"}

3) Req : https://apisandbox.dev.clover.com/v3/merchants/{merchant_id}
using above api_token
Resp : { "message": "401 Unauthorized"} using above api_token.
Is there any permission missing with this token ?
Please help me where I am wrong in these flow ?

API TokenOAuth
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

kesha avatar image
kesha answered ·

Finally I resolved the issue of 401 Unauthorized.

I was getting 401 because my api_token was not granted with any permissions such as merchant, orders, etc.

I created new app in clover sandbox developer account. Though I was going to use only webapp but, I filled information related to android app also.

Steps followed :

1) Go to your clover sandbox developer account and click on Create New App.

2) Fill out Create New App and Quick Android App section.

3) Make sure you give required permissions in Permissions Section.

OR

If you forgot to give the permissions at the time of app creation then you can change it later. Go to Developer Dashboard --> Your Apps --> Your App Settings --> Required Permissions

and give required permissions.

Share
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community