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

feat: allow promises in CookieAuthStorageAdapter #609

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

Conversation

csenio
Copy link

@csenio csenio commented Jul 16, 2023

What kind of change does this PR introduce?

feature / chore

What is the current behavior?

CookieAuthStorageAdapter doesn't await the response of this.getCookie(key).
This limits how much it can be extended as methods like chrome.cookies.getAll always run asynchronously.

What is the new behavior?

getItem in the CookieAuthStorageAdapter is now an async function that awaits the result of this.getCookie(key).
This should not cause any changes in behaviour and is in line with how getItem works in the goTrueClient storage adapter.

Additional context

My personal use case is that I'm making an adapter to use supabase auth in my extension service worker and I prefer extending CookieAuthStorageAdapter over StorageAdapter. I figured other people trying to extend it will run into the same issue eventually so making a PR.

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