question

anujc avatar image
anujc asked Justin Cherniak commented

Oauth is not working

I have created sandbox account and create webapp but when hitting https://sandbox.dev.clover.com/oauth/... it is giving "false". Also when i run this from my browser it prompts "Not Found".

10 |2000

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

rachel avatar image
rachel Deactivated answered

Hi @Anujc,

Can you tell me more about your OAuth flow?

What should happen is:

  • Merchant launches your web app from their dashboard, which appends a code to their request.
    • If that code is missing, redirect the merchant to the oauth/authorize/ endpoint you mentioned, appending your appId (found on your app's settings page): https://sandbox.dev.clover.com/oauth/authorize?client_id={appId}
  • Take the code, your appId, and your appSecret, and submit them to the oauth/token/ endpoint: https://sandbox.dev.clover.com/oauth/token?client_id={appId}&client_secret={appSecret}&code={code}
  • The oauth/token/ endpoint returns an access token. Use this access token, along with the merchantId (similar to the code, you receive the mId as a URL argument when the merchant launches your app), to access API endpoints.
    • The access token is passed in your request header, like so:{"Authorization": "Bearer {access_token}"}

You should store the access token in a database so that you can reuse it the next time the merchant visits your web app; access tokens currently last for one year. Your app should respond to 401 Unauthorized responses with exponential back-off before requesting a new 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.

anujc avatar image
anujc answered

Thanks Rachel, I am very frustrating to implement api in PHP :

https://docs.clover.com/build/develop...

I have written code and trying to post but it shows : https://apisandbox.dev.clover.com/v2/... string(35) "Error connecting to Payment Gateway"

can you check issue, I will provide you code too.

Please please reply asap.

Thanks Brijmohan

10 |2000

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

Justin Cherniak avatar image
Justin Cherniak answered Justin Cherniak commented

Hi @rachel,

I'm seeing errors with the sandbox OAuth server. I deployed the sample app (https://github.com/clover/clover-clou...) on Heroku at https://floating-cove-22921.herokuapp...

I then tried to "Configure Clover Device" and directed the app to https://sandbox.dev.clover.com. It then redirects and follows up to a page that says "Not found" and has a spinner.

I tried this both with the built-in app ID and my own and both resulted in the same behavior.

You can view a video of this here: https://youtu.be/LyRtqOOt9i8

Given I'm just using the example app deployed out of the box, I can't imagine what I'm doing wrong. Please provide some guidance here.

Thank you, Justin

2 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.

Justin Cherniak avatar image Justin Cherniak commented ·

Looking into this more, the URL that is failing on your site is https://sandbox.dev.clover.com/v3/mer...

That's returning a 404, even though the app exists.

0 Likes 0 ·
Justin Cherniak avatar image Justin Cherniak commented ·

I didn't configure pricing which after watching a video posted on another thread was clear that it needed to be done. I'd make that clearer elsewhere to avoid confusion.

0 Likes 0 ·

Welcome to the
Clover Developer Community