supabase-community / auth-ui

Pre-built Auth UI for React
https://supabase.com/docs/guides/auth/auth-helpers/auth-ui
MIT License
488 stars 121 forks source link

What is the point of this? [React] #248

Closed alxvallejo closed 8 months ago

alxvallejo commented 8 months ago

Having a Component is great for handling the UI of initializing the OAuth request. But there's no clear example here on what to do with the response.

Should there be a onAuthStateChange listener in a AuthProvider that wraps around our App? I can't get my AuthProvider to successfully listen for that change in this case.

How else would we listen for a callback using these UI components?

alxvallejo commented 8 months ago

FWIW I wrote a blog post that addresses this: https://medium.com/@seojeek/protected-routes-in-react-router-6-with-supabase-authentication-and-oauth-599047e08163