© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
42 replies
The red man

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);
    }
};
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
Sign in a user through OAuth | Supabase
Sign in a user through OAuth | Supabase
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Supabase + Google Auth + Calendar and Meet Access
SupabaseSSupabase / help-and-questions
6mo ago
Supabase SvelteKit Helper
SupabaseSSupabase / help-and-questions
4y ago
Using sveltekit fetch with supabase auth helpers
SupabaseSSupabase / help-and-questions
4y ago
Supabase Quickstart SvelteKit Tutorial
SupabaseSSupabase / help-and-questions
4y ago