question

dja avatar image
dja asked dja answered

Can't get authentication token

Hello, I am new to clover and I am currently trying to connect to it through its API, but so far I've been unable to do so. First I thought that I could try sandbox mode, I have an unpublished app in my account and I make a curl request like

curl -X GET -H "Accept: application/json" -H "Content-Type: application/json" https://apisandbox.dev.clover.com/oau...id={myappid}&clientsecret={myappsecret}&code={mymerchanttoken}

{myappid} and {myappsecret} are just as they appear in my "Your Apps" section, and {mymerchanttoekn} I get it through an emulator running the clover platform, which I still don't know if it is the code to get an authentication token or the actual authentication token. Either way when I try this request the response says:

{"message":"Unknown Client ID"}

Even though it is the EXACT ID that appears on my dashboard.

After this I tried to change the request to actual clover instead:

url -X GET -H "Accept: application/json" -H "Content-Type: application/json" https://www.clover.com/oauth/token?cl...id={myappid}&clientsecret={myappsecret}&code={mymerchanttoken}

but when I make this request I get

{"message":"Please specify a secret"}

I am really lost to what is happening here, since in one place it tells me there is no app with that ID and in the other it tells me that I am actually sending no secret even though I am. This is my first time with Clover and OAuth so I might be missing something but I couldn't find anything else in the documents that could help me, so any help (or question about my problem) is appreciated.

Update:

I have now created an account at sandbox.dev.clover.com, for some reason I thought this would be created at the same time that my normal account, I really don't get if I have to copy every single app that I might have in my normal account here, that seems somewhat wet (aka not DRY). Now when I make a request to either domain I get the same response:

{"message":"Please specify a secret"}

Update2:

I have seen the video about generating a token through the site, but I am looking to set the real authentication already (OAuth2) instead of having to do it later.

Sandbox
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

dja avatar image
dja answered

As it turns out there were two different things wrong, the first one was that we thought that the merchant_id was 111111111111, since that is what we have so far found through android and in the clover site (MID: 11111111111), thanks to the video we could grab the actual id from our url bar in chrome, but we still need to get it through the android sdk. The second thing was assuming that the token that we got from the android sdk was the code to get an authorization token, it was the actual authorization token and so the step of getting one isn't required.

Now all that remains is getting that merchant and employee id and we are done with this initial connection ^^.

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