question

birdlaw avatar image
birdlaw asked birdlaw answered

401 Unauthorized /oauth/v2/token

I'm experiencing the same issue as @iamaadim5.

https://community.clover.com/questions/47833/expiring-oauth-returning-unauthorized-status-with.html

I do not have the optional launch path configured.


const tokens = await $fetch ( ` ${ cloverEndpoint } /oauth/v2/token` , {
body : {
client_id : process . env .CLOVER_APP_ID,
client_secret : process . env .CLOVER_APP_SECRET,
code : req . input . code ,
},
method : 'POST' ,
headers : {
Authorization : `Bearer ${ process . env .CLOVER_APP_SECRET } `
}

})


Responds with

{
  status: 'Unauthorized',
  message: 'Failed to validate authentication code.'
}



Any clarification of what may be wrong with this request would be extremely helpful.

Best,

Alex

OAuthAuth
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

birdlaw avatar image
birdlaw answered

The problem was I was using the old sandbox endpoint (https://sandbox.dev.clover.com) rather than the new v2 endpoint for the new oauth flow (https://apisandbox.dev.clover.com)

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