Refreshing access token suddenly not working!

Our store has been up and happy for 2 or so years using Square Terminals with my hand rolled POS software. Every 7 days the system has been getting a refresh token and life has been good. This week I got an alert that the refresh token get was overdue. Looking into it I found that the refresh token was null and so not saved hence the alert. So I wiped the access token and refresh token from the database to go get a fresh access token but that returned null for a the fields. Strangly enough (maybe) the response body has all I was looking for, but the c# code I wrote back at the start:

var responseaccessToken = await client.OAuthApi.ObtainTokenAsync(body: body);

is expecting responseAccessToken.AccessToken to contain the token but it is null along with all other fields.

However: responseAccessToken.Response.Body has what I expected an access_token, a refresh_token, today’s date etc.

It has been a couple of years since I had to get an initial token - did something change? The c# callback was working back then and the data was in the database all nice and ecryypted to prove it.

I logged into the square area where the production app is and everything looks as it did years ago.

I have put the existing access_token and refresh_token back in the database so that the store can operate but I’m nervous about no refresh token.


Nothing has changed as far as I know in regards to refreshing the access token. We only return the refresh_token in the ObtainToken call. So if it all the sudden went missing something else is cacheing the token. :slightly_smiling_face:

Sorry for ruining Thanksgiving for everyone. :pensive:

Whilst working on some feature for the POS code I dumbed down Newtonsoft.json to 6.04 (For MS Signalr .net client) and that broke square token get. The API logs revealed that everything was copasetic but alas the obtain token was going into the weeds on this end. And I didn’t see that till today.

I upgraded Newtonsoft back to the latest and greatest and now the POS stations are happy and glad again.

Glad to hear you figured out the root cause of the issue. :slightly_smiling_face: