SupabaseS
Supabase6mo ago
loup

How sign in with Github on Expo ?

I try to sign in with Github using Expo but without success. Ive did :
const redirectUri = AuthSession.makeRedirectUri({
    scheme: 'com.lxup.journal',
});
console.log("GitHub redirect URI:", redirectUri);
const discovery = {
    authorizationEndpoint: 'https://github.com/login/oauth/authorize',
    tokenEndpoint: 'https://github.com/login/oauth/access_token',
};
const [githubRequest, githubResponse, promptAsync] = AuthSession.useAuthRequest(
    {
    clientId: process.env.EXPO_PUBLIC_GITHUB_CLIENT_ID!,
    scopes: ['read:user', 'user:email'],
    redirectUri,
    },
    discovery
);
// ...
case "github":
    const result = await promptAsync();
    console.log("GitHub OAuth result:", result);
    if (result.type === 'cancel') {
        throw new Error('cancelled');
    }
    if (result.type !== 'success') {
        throw new Error("GitHub OAuth failed");
    }
    const { code } = result.params;
    console.log('params:', result.params);
    console.log('github code:', code);
    const { error } = await supabase.auth.exchangeCodeForSession(code);
    if (error) throw error;
    break;
Was this page helpful?