question

Aditya Sharma avatar image
Aditya Sharma asked Aditya Sharma commented

Generate API token through our ERP system

Hi team,

We are working on the integration of the CloverGo device with our Ionic applications. We will be implementing an API on our ERP server that will fetch the token from clover server and return to the app. I went through O-Auth 2.0 documentation but couldn't understand how this can be done

https://docs.clover.com/clover-platform/docs/using-oauth-20


When we hit for CODE

https://sandbox.dev.clover.com/oauth/authorize?client_id={APP_ID}

it needs the user to be authenticated as per the Note in Step 1

https://docs.clover.com/clover-platform/docs/using-oauth-20#section-step-1-request-merchant-authorization

If an unauthorized merchant navigates directly to your app URL without installing the app from the Clover App Market:
  • Redirect the merchant to log in to their Clover merchant account, and then
  • Ask the merchant to install your app from the Clover App Market


Can anyone please help me understand how this can be done?

API 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

·
darrank avatar image
darrank answered Aditya Sharma commented

Did you try the oauth flow specified on that step?


https://sandbox.dev.clover.com/oauth/authorize?client_id={APP_ID}&redirect_uri={CLIENT_REDIRECT_URL}


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

Aditya Sharma avatar image Aditya Sharma commented ·

Thanks @darrank for your quick response. I tried the steps and if I do it manually I am able to do it by logging in but we want to automate through our ERP system

Steps I followed for a manual generation:
1. Generate CODE with below URL (Here if I am not logged in it redirects to login page)

https://sandbox.dev.clover.com/oauth/authorize?client_id={APP_ID}&redirect_uri={CLIENT_REDIRECT_URL}

2. Generate token with below URL

https://sandbox.dev.clover.com/oauth/token?client_id={APP_ID}&client_secret={APP_SECRET}&code={AUTHORIZATION_CODE}

We want to keep credentials on the server and only pass token to the app.

Is there anything I am missing here?

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ Aditya Sharma commented ·

What exactly do you want to automate? The merchant MUST install your app, through that process the merchant is granting your app access to their data. If we allowed you to by-pass this, then any app could obtain a token on a merchant's behalf without their knowledge or consent.

0 Likes 0 ·
Aditya Sharma avatar image Aditya Sharma David Marginian ♦♦ commented ·

Thanks David for your response! Just to brief you with our use case. We are building android/ios applications (using ionic) specific to a single business where the merchant having multiple stores will place orders through our app and make payment with clover go device. The idea is to implement an API at our ERP system that generates the token.

0 Likes 0 ·
Show more comments

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