kucherenko / strapi-plugin-passwordless

A plugin for Strapi Headless CMS that provides ability to sign-in/sign-up to an application by link had sent to email.
MIT License
77 stars 27 forks source link

Add await to createToken #13

Closed GraemeFulton closed 1 year ago

GraemeFulton commented 1 year ago

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!