Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: getServerToken returns null when used in middleware #147

Closed

Conversation

Niki2k1
Copy link

@Niki2k1 Niki2k1 commented Dec 27, 2023

πŸ”— Linked issue

#139

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

When using getServerToken in a middleware the function returns null because it can't read the cookies.
I changed your cookie parsing from the headers to using the h3 function parseCookies

Resolves #139

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@Niki2k1 Niki2k1 requested a review from Hebilicious as a code owner December 27, 2023 13:17
@Niki2k1
Copy link
Author

Niki2k1 commented Dec 27, 2023

Was there a reason you parsed the cookies yourself instead of using the h3 parseCookies function?

@Hebilicious
Copy link
Owner

Was there a reason you parsed the cookies yourself instead of using the h3 parseCookies function?

It wasn't implemented properly in h3 when I created the module, but pretty sure it got fixed now.

@Hebilicious
Copy link
Owner

The fix look good, but I need to find the time to test it as we don't have good test coverage set-up.

@ferat
Copy link

ferat commented Feb 21, 2024

I would like to add that this does not solve getServerToken returning null on the server.
Is there a workaround for getting the user's id?

@Hebilicious
Copy link
Owner

@ferat Could you give #167 a try ? I believe this will resolve the issue and we'll close this PR.

@Niki2k1 Niki2k1 closed this Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getServerSession returns object, getServerToken returns null
3 participants