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

Call authRefresh() to ensure that the loaded cookie is valid #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

PatrickG
Copy link

See pocketbase/js-sdk#85.

The PR adds an additional authRefresh() call to ensure that the loaded cookie is verified and valid.

This is not an issue on its own if you are sending requests only to the PocketBase server (aka. trying to update a user with fake/invalid token will throw an error), but it is a good idea to validate the loaded auth store state server-side so that you can safely trust the pb.authStore.isValid checks (for example if you want to show some private node/3rd party generated content).

Note1: I haven't run the project locally, so please make sure to test it first before merging.
Note2: Sometime later this week I'll also update the SDK SSR examples with the above to avoid eventual security issues in user-land code.

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.

1 participant