Currently there is no 'await' when updating previously stored tokens. So when a user signs up for the first time, sometimes, the create() function can run before update(), as we don't wait for update to finish.
That can result in the new token being invalidated by getting set to is_active:false almost immediately. That's why sometimes when you request a token, it's already invalid, and you have to request a new one.
Adding await to the update fixes that issue for me!
Currently there is no 'await' when updating previously stored tokens. So when a user signs up for the first time, sometimes, the
create()
function can run beforeupdate()
, as we don't wait for update to finish.That can result in the new token being invalidated by getting set to
is_active:false
almost immediately. That's why sometimes when you request a token, it's already invalid, and you have to request a new one.Adding
await
to the update fixes that issue for me!