question

wdfinch avatar image
wdfinch asked Lauren Worthington answered

Get OAuth token server to server

I am trying to build an online ordering feature for a merchant's website. In order to process the payment for the order, I need to get an OAuth token. It seems from the docs that the only way to get the token is when an employee opens my web app from their clover dashboard.

However, this obviously won't work as random people will be using the site to order who don't have any access to the clover dashboard.

Is there a way for my server to get an OAuth token directly without having an employee open the app from clover?
OAuth
10 |2000

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

Lauren Worthington avatar image
Lauren Worthington answered
Hi @wdfinch and @Lee Tickett!
Lee is correct, securely storing the token is a valid (and common) solution. You should set up your app to avoid/handle the case of the token expiring. It expires when a merchant uninstalls your app or after it's one year lifespan.
10 |2000

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

Lee Tickett avatar image
Lee Tickett answered
You should have an employee launch the app after first installation. This will generate a token which you can then store and re-use.
I don't believe Clover have ever publicized how long the tokens last, but they don't expire for "quite some time" so you should be AOK.
Hopefully someone at Clover will confirm that is the correct approach :)
L
10 |2000

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