AuthenticationFacebook Login

Facebook Authentication

Follow these steps to set up Facebook Authentication.

Step 1: Create a Facebook App

  1. Go to the Facebook Developers Console.
  2. Click on “Get Started” and follow the prompts to create a developer account if you haven’t already.
  3. Once your account is set up, navigate to “My Apps” and click “Create App.”
  4. Choose “For Everything Else” and click “Next.”
  5. Enter your app’s name and email, then click “Create App ID.”
  6. On the app’s dashboard, go to “Add a Product” and select “Facebook Login.”

Step 2: Configure Facebook Login

  1. In the “Facebook Login” section, select “Web.”
  2. Under “Valid OAuth Redirect URIs,” add your redirect URL:
    • http://localhost:3000/api/auth/callback/facebook for local development.
    • https://example.com/api/auth/callback/facebook for production.

Step 3: Copy Credentials to .env.local

  1. After creating your Facebook App, go to “Settings” > “Basic” and copy the App ID and App Secret.
  2. In your project’s .env.local file, add the following environment variables and paste the values:
    • FACEBOOK_CLIENT_ID
    • FACEBOOK_CLIENT_SECRET