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: add support for storage key #61

Closed
wants to merge 3 commits into from
Closed

Conversation

J0
Copy link
Contributor

@J0 J0 commented Sep 4, 2024

What kind of change does this PR introduce?

Address #19 to allow developer to configure storageKey when using createBrowserClient() client side. Not relevant for server-side as cookies are used there.

@J0 J0 marked this pull request as ready for review September 11, 2024 14:09
@hf
Copy link
Collaborator

hf commented Sep 12, 2024

Wait why not createServerClient? These values must be synced up, otherwise wrong cookies will be read.

@J0
Copy link
Contributor Author

J0 commented Sep 12, 2024

Initial consideration was that on server side they'd be able to set it via: options?.cookieOptions?.name - was under impression from description that we primarily to want to allow the option of setting storageKey via options?.cookieOptions?.name on browser

It seems fine to allow this on createServerClient as well though. Pushed up to support on createServerClient as well

@J0 J0 force-pushed the j0/add_support_for_storage_key branch from 0c7d2e1 to c286d2f Compare November 11, 2024 05:37
@J0 J0 requested a review from hf November 11, 2024 05:37
@J0 J0 force-pushed the j0/add_support_for_storage_key branch from c286d2f to d5e8ebb Compare November 11, 2024 06:13
@J0
Copy link
Contributor Author

J0 commented Nov 13, 2024

Hey @hf @j4w8n,

Rounding out old PRs here - could I trouble y'all for a review when free? Happy to close too if this is not something we wish to pursue

@j4w8n
Copy link
Contributor

j4w8n commented Nov 13, 2024

I just tested things as they are, in v0.5.1, and had no issues setting the cookie name via { auth: { storageKey: 'thing' } }. The ...auth?.options lines take care of this behavior. Has anyone been able to reproduce the issue? It tried to see if things changed with another PR, but didn't find anything.

No matter what, we should consider changing the order of things though. For instance, ...auth?.options is before ...(options?.cookieOptions?.name in the browser client, but they're reversed in the server client. Which means if someone happened to set both, and the values were different, then they'd get inconsistent results. I doubt someone would do those things, but it might benefit us to align the order.

@j4w8n
Copy link
Contributor

j4w8n commented Nov 13, 2024

Actually, perhaps as a side effect, @hf looks to have resolved the user's issue with the v0.4.0 rewrite. Y'all can double-check, but I think we can close this PR. My tiny concern with the order of things might want to be addressed though.

@J0

@J0
Copy link
Contributor Author

J0 commented Nov 13, 2024

Sounds good, thanks for the input! Note that we should look into the ordering.

@J0 J0 closed this Nov 13, 2024
@J0 J0 mentioned this pull request Nov 13, 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.

3 participants