nuxt-iam icon indicating copy to clipboard operation
nuxt-iam copied to clipboard

Problem with Reauthentication (setCookie)

Open mobius77 opened this issue 2 years ago • 0 comments

Hello.

In file \server\middleware\iam\authentication\index.ts we call 2 functions:

  • const authenticated = await isAuthenticated(event)
  • await getUserFromAccessToken(event)

In first function we setCookie if we reauthenticate user: setCookie(event, 'iam-access-token', 'Bearer ' + tokens.accessToken, { httpOnly: true, secure: true }) , but when we read this cookies in second function: getCookie(event, "iam-access-token") as string; we got an old value until next request.

I thought that it must be some time between set and get cookies and have added pause-function for 10sec, but problem still there. Cookie don't want to set until next request.

mobius77 avatar Nov 22 '23 10:11 mobius77