Refreshing the access token in Unity?

Hi, we are developing a game using Unity and AccelByte services. Recently we found out that after a user spends more than 1 hour in the app we are developing, the access token expires, and other services we use stop working because of that.
We’d like to know what’s the best practice in this case to refresh the token. Should we put a task when logging in that will log in again in expires_in seconds or is there an automated way to do this?
Thanks!

Hi @xalbertus
The team will take a look at this soon!

Hello @xalbertus , I’m the dev of Unity SDK.

The SDK has auto refresh token scheduler, and it maintained using coroutine of a GameObject “AccelByteDummyGameObject”. Please check out if the gameobject isn’t destroyed.

There’s a way to call refresh token manually.
You can call AccelByteSDK.GetClientRegistry().GetApi().GetUser().RefreshSession(callback);

@xalbertus have you solved this issue?

Hi Everaldo,
we think it’s solved. We ended up placing a task to be executed 5 minutes before the token gets expired that calls RefreshSession and the token gets renewed, so for now I think we are good.

Thanks a lot!