codingki / react-native-expo-template

My starter templates for building apps with react native and expo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How are you reading the magic link?

farzd opened this issue · comments

This doesn't really cover how the magic link is being read inside the app?
You can create link according to the app type: https://docs.expo.io/guides/linking/
But i don't understand how supabase.auth.session(); or supabase.auth.onAuthStateChange can pick up the accesstoken from the query param? does supabase does this automatically?

Also the useEffect here will only run if there is a user, which there isn't initially?
https://github.com/codingki/react-native-expo-template/blob/master/template-typescript-bottom-tabs-supabase-auth-flow/src/provider/AuthProvider.tsx

@farzd this repo doesn't have an example for linking yet, but maybe in the future. You can read more about linking here https://reactnavigation.org/docs/deep-linking/ But I haven't tried it myself.

the useEffect there will only run when the first time render and when the user state changed, not when there is a user only.

and this is the Auth flow

export default () => {
	const auth = useContext(AuthContext);
	const user = auth.user;
	return (
		<NavigationContainer>
			{user == null && <Loading />}
			{user == false && <Auth />}
			{user == true && <Main />}
		</NavigationContainer>
	);
};

Thanks @codingki i understand how linking works but i dont think supabase is picking up the query params
I posted an issue here: supabase/supabase-js#188