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

Redesign of auth listener handling #104

Open
domhel opened this issue Jul 6, 2024 · 1 comment
Open

Redesign of auth listener handling #104

domhel opened this issue Jul 6, 2024 · 1 comment

Comments

@domhel
Copy link
Contributor

domhel commented Jul 6, 2024

Chore

Describe the chore

I've noticed the issue because I am using both SupaEmailAuth and SupaSocialsAuth. Social auth subscribes to the auth changes directly and calls the onSuccess method when we are logged in, while the email auth uses async - await for log in and then calls the given callback. What happens when I have both is that when logging in via email, first the email callback is called, and then the social onSuccess callback is called as well, because the listener is active. Magic auth would also subscribe to the change, so that would make 2 subscriptions and one async-await when using all three on one page.

One could argue that I should only implement the social login callback and ignore the email callback, but that would simply be a workaround. Also, I use flavors in which some apps have social auth and some not, and it would not be pretty to modify the listeners depending on the current flavor.

I propose a change where we can decide to not subscribe to auth changes and instead handle the login or signup ourselves.
Another option would be to wrap our login page with another widget that holds the auth listener and provides some callbacks for the auth events.

domhel added a commit to domhel/flutter-auth-ui that referenced this issue Jul 6, 2024
domhel added a commit to domhel/flutter-auth-ui that referenced this issue Jul 6, 2024
@domhel
Copy link
Contributor Author

domhel commented Jul 7, 2024

fyi I propose a PR soon

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

No branches or pull requests

1 participant