The Google provider configuresDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nuxt-alt/auth/llms.txt
Use this file to discover all available pages before exploring further.
@nuxt-alt/auth to authenticate users through Google’s OAuth2 service. It uses the oauth2 scheme and wires up Google’s authorization and userinfo endpoints automatically. The userinfo endpoint targets the Google OAuth2 v3 API, which returns standard OpenID Connect claims such as sub, name, picture, and email. Your clientId and clientSecret come from a Google Cloud project with the OAuth2 API enabled.
Required Options
| Option | Type | Description |
|---|---|---|
clientId | string | The OAuth 2.0 Client ID from Google Cloud Console |
clientSecret | string | The OAuth 2.0 Client Secret from Google Cloud Console |
Configuration
Auto-Configured Defaults
When the strategy name isgoogle, the provider automatically sets the following values. Any property you specify in your own config takes precedence.
| Property | Auto-Configured Value |
|---|---|
scheme | 'oauth2' |
endpoints.authorization | https://accounts.google.com/o/oauth2/v2/auth |
endpoints.userInfo | https://www.googleapis.com/oauth2/v3/userinfo |
scope | ['openid', 'profile', 'email'] |
token.property | 'access_token' |
token.type | 'Bearer' |
token.name | 'Authorization' |
idToken.property | 'id_token' |
refreshToken.property | 'refresh_token' |
responseType | 'token' |
clientSecretTransport | 'body' |
Logging In
Trigger the Google OAuth redirect from any component or composable:@nuxt-alt/auth exchanges the token and fetches the user profile.
In the Google Cloud Console, navigate to APIs & Services → Credentials and add your application’s callback URL to the Authorized redirect URIs list for your OAuth 2.0 Client ID. The default callback route is
/login. You must also configure the OAuth consent screen and ensure the email, profile, and openid scopes are listed as non-sensitive scopes.