Google Calendar Integrations Using SvelteKit and Supabase

I'm having trouble with Google Calendar integrations. I'm under the impression that doing a scoped OAuth sign in should return a token, but for some reason I only get back a {provider, url} object. Has anyone else come across anything like this?

In the docs it says that there should be a data.session.provider_token, but I get an error when trying to access this property...
https://supabase.com/docs/reference/javascript/auth-signinwithoauth

export const integrateGoogleCalendar = async (): Promise<void> => {
    try {
        localStorage.setItem('auth_context', 'google_calendar_integration');
        const { data: authData, error: authError } = await supabase.auth.signInWithOAuth({
            provider: 'google',
            options: {
                scopes: 'https://www.googleapis.com/auth/calendar'
            }
        });

        if (authError) {
            console.error('OAuth authError:', authError);
            throw authError;
        }

        if (!authData) {
            console.error('OAuth authData is null');
            throw new Error('OAuth authData is null');
        }

        console.log('googleintegration return authData:', authData);

        await delay(1000);

        addToast('Google Calendar integrated successfully.', { duration: 5000, closable: true });

    } catch (error) {
        handleError(error);
    }
};
Screenshot_2023-12-16_at_4.36.11_PM.png
Was this page helpful?