First I get a code using this endpoint: https://www.clover.com/oauth/authorize?client_id=9...
Then I get my token: https://www.clover.com/oauth/token?client_id=9QN8D...
I then use that token to make RESTful calls.
Everything works fine in sandbox mode. it fails when I go against the production API endpoints.
Have you tried uninstalling and reinstalling the application?
I would also check your app secret and app ID are your production app's and not your sandbox app's.
I am sure that my app secret and app ID are correct for production. I doubled checked.
I'm not sure what you mean by uninstall/reinstall my app. I am running this code from my local computer, from a python file. @zgreathouse
Apologies, I am not sure I understand the question. The code which is used to fetch the token expires after a single use. The token however does not expire until the app has been uninstalled. If OAuth is being implemented properly, each time a Merchant logs into your app, a new code and therefore a new token should be acquired each time.
(See a python OAuth example here: https://github.com/cloverhackathons/OAuthPython)
However, if permissions have been updated since installing your production app to your production test merchant- you must uninstall and reinstall your production app on the production test merchant for the new permissions to go into effect. After reinstalling the app you need to request a new token, as any tokens previously acquired were expired upon uninstalling the app.
Basically if you have confirmed the following:
- Base url is correct in exports endpoint
- MerchantId is correct in exports endpoint
- App Secret used to fetch token is correct
- App Id (Client Id) used to fetch token is correct
- App is installed on the merchant you are fetching exports for
- Required permissions are set on your app
Then the last thing to determine is if the token is valid. It is possible the token does not have the proper permissions. For clarification the token will have the permissions which were set at the time the Merchant installed the app. So if after installing the app you add Order Read permissions, you cannot get a token with those permissions until the Merchant uninstalls/ reinstalls the app. Subsequent tokens will have the newly added permission.
1 Person is following this question.