Skip to main content

Documentation 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.

The Facebook provider configures @nuxt-alt/auth to authenticate users through Facebook Login. It uses the oauth2 scheme and targets Facebook’s v2.12 Graph API for both the authorization dialog and user profile retrieval. The userinfo endpoint is pre-configured to request the about, name, picture, and email fields from the Graph API, so you get a rich user object immediately after login without any extra API calls.

Required Options

OptionTypeDescription
clientIdstringThe App ID from your Facebook App dashboard
clientSecretstringThe App Secret from your Facebook App dashboard

Configuration

export default defineNuxtConfig({
  auth: {
    strategies: {
      facebook: {
        clientId: 'YOUR_APP_ID',
        clientSecret: 'YOUR_APP_SECRET',
        // Optional: override the default scopes
        scope: ['public_profile', 'email'],
      },
    },
  },
})

Auto-Configured Defaults

When the strategy name is facebook, the provider automatically sets the following values. Any property you specify in your own config takes precedence.
PropertyAuto-Configured Value
scheme'oauth2'
endpoints.authorizationhttps://facebook.com/v2.12/dialog/oauth
endpoints.userInfohttps://graph.facebook.com/v2.12/me?fields=about,name,picture{url},email
scope['public_profile', 'email']
token.property'access_token'
token.type'Bearer'
token.name'Authorization'
refreshToken.property'refresh_token'
responseType'token'
clientSecretTransport'body'

Logging In

Trigger the Facebook Login redirect from any component or composable:
const auth = useAuth()
await auth.loginWith('facebook')
The user is presented with Facebook’s login dialog and permission request. After granting access, Facebook redirects back to your application’s callback route where @nuxt-alt/auth processes the token and fetches the user profile from the Graph API.
In your Facebook App dashboard, navigate to Facebook Login → Settings and add your application’s callback URL to the Valid OAuth Redirect URIs list. The default callback route used by @nuxt-alt/auth is /login. Your app must also be in Live mode (or the authenticating user must be a test user) for the login flow to work in production.

Build docs developers (and LLMs) love