question

thedangler avatar image
thedangler asked chrispetchey answered

access_token from OAuth as bearer API Token not working

How come when I generate an access token using OAuth/v2token and use it in the https://docs.clover.com/reference playground it doesn't work. How come I have to generate an API token in the test merchant account.

Is the bearer token the access token returned from oauth/v2/token end point. The documentation is not very clear.

I should be able to use access_tokens generated from the api in the playground.


I also noticed your documentation mentions testing should use these urls

https://apisandbox.dev.clover.com/v3/merchants/mId

however the playground uses:

https://sandbox.dev.clover.com/v3/merchants/mId

So is that why the access_token generated by oauth request doesn't work in the playground?

Your documentation is so confusing.


REST APIAPI Token
10 |2000

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

parquet76 avatar image
parquet76 answered thedangler commented

I avoid executing request from the API reference like the plague, you should too, have no idea why clover even has that activated.

1 comment
10 |2000

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

thedangler avatar image thedangler commented ·

Turns out

                    
  1. https://sandbox.dev.clover.com/v3/merchants/mId

Is the correct one, however I still find it weird that I can't use a generated access_token as my Bearer in the playground.

I have a feeling the base uri's and enpoints are going to be a nightmare moving forward.

Maybe you can help me with my other question that still doesn't work.
Question about OAuth 2 flow.

Basically, if someone clicks on the link inside clover dashboard it sends the client_id,merchant_id,code, and employee_id.
I send back to the uri as documented

https://apisandbox.dev.clover.com/oauth/v2/token

client_id,code,client_secret,merchant_id. But it never works and I get a Failed to validate authentication code error.

So if I see that error in the response I send the user back to the /oauth/v2/authrize endpoint which sends me back the client_id,merchant_id,code, and employee_id again to which i send it back to the

and then it sends me back the access_token and refresh_token.

So basically the code sent from clover dashboard is never correct for some reason.

Do you have any idea what might be going on?


Thanks

0 Likes 0 ·
chrispetchey avatar image
chrispetchey answered

Is this for use with an app (merchant adds app to their account and you create an access token from the merchant and your appid) ?

10 |2000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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