Fix Supabase OAuth flow and various UI updates

This commit is contained in:
RoadtripDJ Dev
2026-05-17 20:48:19 +01:00
parent ad64bb2572
commit dedf25c51f
7 changed files with 326 additions and 57 deletions

View File

@@ -5,6 +5,7 @@ import { colors } from '../../utils/colors';
import { supabase } from '../../services/supabase';
import { makeRedirectUri } from 'expo-auth-session';
import * as WebBrowser from 'expo-web-browser';
import * as QueryParams from 'expo-auth-session/build/QueryParams';
WebBrowser.maybeCompleteAuthSession();
// @ts-ignore
@@ -58,8 +59,14 @@ export default function RegisterScreen({ navigation }) {
const res = await WebBrowser.openAuthSessionAsync(data.url, redirectUri);
if (res.type === 'success') {
const { url } = res;
// Ensure Supabase catches the session from the returned URL
await supabase.auth.getSessionFromUrl(url);
const { params, errorCode } = QueryParams.getQueryParams(url);
if (errorCode) throw new Error(errorCode);
if (params.access_token && params.refresh_token) {
await supabase.auth.setSession({
access_token: params.access_token,
refresh_token: params.refresh_token,
});
}
}
}
} catch (err: any) {