#How can I define the google scopes for authorization
3 messages · Page 1 of 1 (latest)
Hi @fallow hare. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To define the Google OAuth scopes for authorization in Convex, you can customize the Google provider configuration when setting up your authentication. Here's how you can do it:
- In your auth configuration file (typically
auth.tsor similar), import the Google provider:
import Google from "@auth/core/providers/google";
- When configuring the
convexAuthfunction, you can customize the Google provider by passing an object with theauthorizationparameter:
export const { auth, signIn, signOut, store } = convexAuth({
providers: [
Google({
authorization: {
params: { scope: "your desired scopes here" },
},
}),
// Other providers...
],
// Other configuration options...
});
- Replace "your desired scopes here" with the specific Google OAuth scopes you want to request, separated by spaces.
For example, if you want to request access to the user's profile and email, you might set it up like this:
Google({
authorization: {
params: { scope: "<https://www.googleapis.com/auth/userinfo.profile> <https://www.googleapis.com/auth/userinfo.email"> },
},
})
This approach allows you to customize the OAuth scopes requested from Google during the authentication process.
Discord support thread: Setting oauth scopes with Convex Auth (https://discord.com/channels/1019350475847499849/1268225086574432307)