Skip to content

How to handle third-party providers login? #497

Discussion options

You must be logged in to vote

I was checking the Slack clone example and looking at _app.js seems to me that I should set the supabase.auth.onAuthStateChange() listener.

Am I maybe getting closer? 😊

Solution

Well looks like thanks from your examples I've been able to solve my doubts, in order to reference I am adding the useEffect that I am using just to give reference to other users that maybe could experience a similar issue.

React.useEffect(() => {
	const { data: authListener } = supabase.auth.onAuthStateChange(
		async (event, session) => {
			setUser(session?.user ?? null);
		}
	);

	// Cleanup function
	return () => {
		authListener.unsubscribe();
	};
}, [setUser]);

I am going to leave open the question just to …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@silentworks
Comment options

Answer selected by AndreaBarghigiani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants