#@nuxtjs/supabase signInWithOAuth with provider scopes?

1 messages · Page 1 of 1 (latest)

dawn cosmos
#

I have login up and running using nuxtjs/supabase module and google provider.
The next step is to add access to a google spreadsheet. For this i have configured the google cloud project to have access to the spreadsheet api. As i need to give a logged in user access to a spreadsheet that normally would not have, i need to authorize the user by login with a scope.
I have seen that using supabase-js directly in the createClient there would be the possibility to it like

const supabaseClient = createClient(
    process.env.SUPABASE_URL,
    process.env.SUPABASE_KEY,
    {
      auth: {
        // Setzen Sie hier die zusätzlichen Scopes für Google OAuth
        scopes: 'https://www.googleapis.com/auth/spreadsheets',
      },
    }
  );

Is there a builtin way to tell the module doing that?

jolly chasm
#

@nuxtjs/supabase is a Nuxt module for first class integration with Supabase.

GitHub

Supabase module for Nuxt. Contribute to nuxt-modules/supabase development by creating an account on GitHub.

dawn cosmos
#

@jolly chasm thank you. I know these documentations. As mentioned signin process using provider is running. The difficulty is to provide scopes to Google, so that the returning access_token provides the rights to the asked scopes. In my concrete scenario it is the Google spreadsheet API. The documentation about scopes in supabase reguards to the supabase scopes. If it is not possible out of the box i have to write a Plugin by creating the supabase Client myself instead of using the Module. I wanted to avoid this

jolly chasm
# dawn cosmos <@1068030499618050159> thank you. I know these documentations. As mentioned sign...

if you can implement it by supabase client, I thinks it can be move to new code by nuxt/subapase module.
maybe you can send scopes when you start login, just like this:

const supabase = useSupabaseClient()
supabase.auth.signInWithOAuth({
  provider: 'google',
  options: {
    scopes: 'xxxx'
  }
})

or you can set the scopes value at nuxt.config.ts.

export default defineNuxtConfig({
   ...
    supabase: {
        clientOptions: {
            auth: {
                scopes: "xxxx"
            }
        }
    }
});

you can try these way, but I am not sure is work, because I am not familiar Google Login, and I don't have GCP account, so I can't try it.

and additional topic, I don't find the createClient function have options.auth.scopes parameters.