question

kwenterprises avatar image
kwenterprises asked David Marginian answered

Sandbox always returns 401 unauthorized

I have read multiple articles, docs, and other sources like https://community.clover.com/questions/28804/always-showing-401-unauthorized-in-the-rest-api-ca.html but I cannot resolve my issue. I am using Postman to start exploring the API sandbox but I keep receiving a 401 response.

Now, I even tried using https://docs.clover.com/reference/merchantgetmerchant but that returns a 401 as well. This leads me to question if my Developer Test Store is valid. I believe it is because I used the credentials a while ago successfully but maybe something has changed. I added a couple additional stores for good measure but they fail as well.

REST APIAPI Token
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.

David Marginian avatar image
David Marginian answered

C1......J1 is a production merchant, not a sandbox merchant so you just exposed a production access token. I will have to revoke that token and you will need to generate a new one. Sandbox and production are separate environments, if you want to test in sandbox (which is where you should be testing) you need to create an account in sandbox - https://docs.clover.com/docs/401-unauthorized#use-the-right-environment.

1 comment
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.

OK. I was logged into the real clover site and not the sandbox site. Will course correct.


0 Likes 0 ·
David Marginian avatar image
David Marginian answered David Marginian edited

Are you passing the access token in the query string or as a header? https://docs.clover.com/docs/using-api-tokens

Other than that, everything you need to know regarding resolving 401s is in the article you already linked to https://community.clover.com/articles/23744/resolving-401-unauthorized-responses-when-making-a.html - read it very carefully.

If you still can't figure it out then you will need to provide us some details such as, your merchant id, the request you are making (exactly), how you are obtaining the token, etc.

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.

kwenterprises avatar image
kwenterprises answered David Marginian converted comment to answer


David - I read that 401 article too and believe I have everything set properly. Here are some screens of the Postman call and Environment variables.

Side Note - Clover shows 2 different sandbox url's. one is apisandbox.dev.clover.com and the other is sandbox.dev.clover.com . I have used both with the same result.

1633093431021.png


1633093440002.png


1633093431021.png (58.7 KiB)
1633093440002.png (12.4 KiB)
4 comments
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.

Ok, you will need to answer the questions I previously asked if you would like more assistance. The postman screenshot is not helpful beyond seeing that you are correctly passing a token value, I don't know your merchant id, etc.

If you still can't figure it out then you will need to provide us some details such as, your merchant id, the request you are making (exactly), how you are obtaining the token, etc.
0 Likes 0 ·
kwenterprises avatar image kwenterprises David Marginian ♦♦ ·

MID - C1...J1

Token is created by logging into my account and clicking the API Token generator from Account & Setup.

Request:

1633095664397.png


0 Likes 0 ·
1633095664397.png (12.9 KiB)

Please don't post tokens in a public forum, sandbox or not. Your URL is incorrect, fix that per my above comment and let me know.

0 Likes 0 ·

Welcome to the
Clover Developer Community