Facebook OAuth
Guide to configuring Facebook (Meta) OAuth authentication
Overview
This document provides a guide on how to configure and use Facebook OAuth authentication. The implementation allows users to sign in using their Facebook (Meta) accounts.
Facebook App Configuration (Meta for Developers)
To use Facebook OAuth, you must create and configure an app on the Meta for Developers platform.
1. Create a Facebook App
- Log in to the Meta for Developers portal.

- Click on My Apps and then click Create App.
- In the app-creation wizard, select the Authenticate and request data from users with Facebook Login use case.
- Enter an app name and contact email.

- Click Create App.

2. Configure Facebook Login
Facebook does not accept localhost for this configuration. For local development, start an ngrok tunnel for your application and use the active HTTPS ngrok URL in the Meta dashboard and environment variables below.
- In the app dashboard, open Use cases and select Authenticate and request data from users with Facebook Login.
- Click Customize for the Facebook Login use case.
- In the use-case settings, add your callback URL under the redirect URI configuration:
- Development (ngrok):
https://<your-ngrok-domain>.ngrok-free.dev/api/iam/facebook/connect/callback - Production:
https://your-api-domain.com/api/iam/facebook/connect/callback
- Development (ngrok):
- Confirm that the
emailandpublic_profilepermissions are enabled. - Open App settings > Basic and add your ngrok URL to App domains (for example,
https://<your-ngrok-domain>.ngrok-free.dev). Do not include a callback path. - Save the changes.
3. Get App ID and App Secret
- Navigate to App Settings > Basic.
- Copy the App ID.
- Click Show next to App Secret (you may need to re-enter your password) and copy the secret.
Configuration (Environment Variables)
Add the following environment variables to your .env file:
# Facebook OAuth Configuration
IAM_FACEBOOK_OAUTH_CLIENT_ID=your-app-id
IAM_FACEBOOK_OAUTH_CLIENT_SECRET=your-app-secret
IAM_FACEBOOK_OAUTH_CALLBACK_URL=https://<your-ngrok-domain>.ngrok-free.dev/api/iam/facebook/connect/callback
IAM_FACEBOOK_OAUTH_REDIRECT_URL=http://localhost:3001/auth/initiate-facebook-oauthAuthentication Flow


The user selects “Sign in with Facebook” in your application.
Your application redirects the user to Facebook's authorization page.
The user signs in to Facebook and grants the requested permissions.
Facebook redirects to the configured callback URL with an authorization code.
SolidX exchanges the authorization code with Facebook and retrieves the user's identity information.
SolidX establishes an authenticated session and redirects the user back to your application.

