question

Ghalib Soomro avatar image
Ghalib Soomro asked Frank Faustino Deactivated commented

Experiencing an 'Unauthorized credential' error when using the API to obtain and submit an Oauth Token

$getAccessToken = $client->request('GET', 'https://api.clover.com:443/oauth/token?client_id='.Session::get('client_id').'&client_secret='.$secret.'&code='.Session::get('code').'');
$access_token= json_decode($getAccessToken->getBody(), true);
$Authorization= 'Bearer '.$access_token['access_token'];
'headers' => [
    'Authorization'=>$Authorization,
    'X-RateLimit-tokenLimit'=>16
],
REST APIOAuthAPI 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.

1 Answer

Frank Faustino avatar image
Frank Faustino Deactivated answered Frank Faustino Deactivated commented
Make sure you're using the following URLs to obtain the OAuth access_token:

Production: https://www.clover.com
Sandbox: https://sandbox.dev.clover.com

Once you have the access_token, then use the following URLs as the base URLs for REST API calls:

Production: https://www.clover.com
Sandbox: https://apisandbox.dev.clover.com
12 comments
10 |2000

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

Frank Faustino avatar image Frank Faustino ♦♦ commented ·

Here's a link to a working example of an OAuth implementation:
(See the endpoints in the project for reference.)

https://github.com/cloverhackathons/OAuthNodeExpress

0 Likes 0 ·
Ghalib Soomro avatar image Ghalib Soomro commented ·
Thanks it worked fine on my end. But when i submitted my app for approval they are still getting same issue (image attached: capture.jpg). Although i have tested in several times.

Cant check on my end as its working fine on my merchant. Is there any way I can create a merchant to test this app other that the merchant i am using to create this app.

0 Likes 0 ·
capture.jpg (101.4 KiB)
Frank Faustino avatar image Frank Faustino ♦♦ Ghalib Soomro commented ·

Please review the answer in the post below, verify that you've gone through these troubleshooting steps and if app approval is still blocked please let us know:

https://community.clover.com/questions/16001/production-app-review-401-unauthorized-http-error.html?childToView=16004#answer-16004

0 Likes 0 ·
Ghalib Soomro avatar image Ghalib Soomro commented ·
on my side its working fine but on other merchants have gone through these steps uninstall and then install again its still showing 401 unauthorized what can we do in this situation.....
0 Likes 0 ·
Frank Faustino avatar image Frank Faustino ♦♦ Ghalib Soomro commented ·

Can you clarify what you mean when you say it's working fine on your side but not on other merchants?

Which endpoints are you experiencing the 401 unauthorized errors? All of them or just some of them?

0 Likes 0 ·
Ghalib Soomro avatar image Ghalib Soomro Frank Faustino ♦♦ commented ·

The merchant that's associated with this account that's being used from the start is working. It worked even after removing the app several times and installing again. Clover's approval team asked us to change APIs from Sandbox to Live and now we are in production mode. Clover's review team was able to access it 5 months ago and now isn't able to access the app at all, attached is what they're getting. The app is in production mode yet, hasn't been approved since review team hasn't been able to run / open the app.

Yes, its a 401 unauthorized error!



0 Likes 0 ·
Show more comments
Ghalib Soomro avatar image Ghalib Soomro commented ·
Hi frank please reply above question....
0 Likes 0 ·
Bryanne Vega avatar image Bryanne Vega commented ·
Are you sending the OAUTH Token or Code in your request?

Also, please mask the code/tokens.
0 Likes 0 ·
Show more comments

Welcome to the
Clover Developer Community