OAuth refresh token issues

in Development
Hi Lightspeed team,
We're trying to solve an issue with our OAuth refresh token.
When we're trying to use refresh token to get new tokens, we're not getting any response back. Maybe you can help check the logs on your end? My company is Push Operations.
We were also trying to use the Lightspeed staging account to test but the redirect_url parameter doesn't seem to work?
Thanks,
Ryan
Best Answer
-
LucienVersendaal Moderator, Lightspeed Staff Posts: 991 moderator
Hi @RyanAtPush,
Correct error 1015 means rate limits.
Answers
Hi @RyanAtPush,
Thank you for contacting us.
Can you provide me the full request? And error messages?
Hey Lucien, I'm not sure if it's ok to show our tokens in this thread?
Hi,
You can send the request and response without the sensitive details (like token).
We seem to be getting a couple of different responses.
One of the response types in couldn't be json decoded. This happens in production environment but not our own testing server. On our testing server I would send the request and it would work perfectly fine. Testing server shares the same database, client key, client secret, code challenge and verifier.
We use php json_decode (https://www.php.net/manual/en/function.json-decode.php) on the curl response but the json_decode returns null.
I'm going to deploy some more debugging logs to print out the raw output before json decode and see...
The second type of response we're getting is the 400 bad request.
Does this happen if the request token is expired?
For example we get this from Five Guys Quebec (Koeppel Companies):
"url": "https://lightspeedapis.com/resto//oauth2/v1/token",
"postBody": {
"grant_type": "refresh_token",
"refresh_token": "...."
"response": {
"code": "bad_request",
"message": "Bad Request",
"statusCode": 400,
"details": [
{
"code": "invalid_request",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
}
]
}
Hi Ryan,
There is an additional slash sign behind resto in your URL.
When doing a refresh token request, you can get a 400 error when there is no refresh_token provided or it is incorrect or expired. As a reminder, refresh tokens can only be used once and expire after 30 days. If expired, the merchant will need to reauthorize the app.
Lightspeed HQ
I fixed the extra slash sign but I'm still getting this error code 1015.
{
"url": "https://lightspeedapis.com/resto/oauth2/v1/token",
"postBody": {
"grant_type": "refresh_token",
"refresh_token": "..."
},
"rawResponse": "error code: 1015",
}
Last sent 2022-01-18 23:01:18 UTC.
TKR Restaurant West Ltd.
Thanks for clarifying the 400 error.
Seems like error code: 1015 means rate limiting, is that right?
Thanks for confirming. Will fix this soon.