What causes user token to expire prematurely?

Several times I have the issue where a freshly logged in user will have their token unavailable with what I am assuming the system expiring it. This is without logging them out. Sometimes it happens after making API calls where they’ve made these calls a million times and it works fine but just randomly a token is unavailable…

My instinct tells me that perhaps I should be providing the user token with each API call I make even though the documentation doesn’t require it?

Why does the user token seem to randomly expire or become unavailable?

Hi Mike,

Could you please describe how you determine that the user token has expired?

Regards,
Mark

I receive error codes with the message that the user token is invalid

Life of a user token is extended every time you pass it to the server with subsequent calls after you obtain the user token initially. Also, could you check in Backendless Console whether sessions are enabled? You can do that on the Users > Login screen - see the “Enable session timeout” setting.

I do not have Enabled Session Timeout set to on… Is this problem? Furthermore, I’m not passing the userToken with all of my API calls. Should I be doing this?

Yes, passing user token with every request is a good idea as it will help with session continuity.

As it turns out, I was accidentally passing the ObjectId instead of the userToken in some calls and this was causing the “user token does not exist” issue. Thank you again for your quick help.