Facebook OAuth setup for Authverse projects
This page details how to add and configure Facebook OAuth for Authverse projects.
Execute the following command to add the Facebook provider to your project:
npx authverse@latest oauth facebookTo use Facebook sign in, you need a client ID and client Secret. You can get them from the Facebook Developer Portal. Select your app, navigate to App Settings > Basic, locate the following:
Navigate to the Facebook Developers Console (My Apps → [Your App] → Use cases → Authentication) and configure the Redirect URIs:
http://localhost:3000/api/auth/callback/facebookhttps://example.com/api/auth/callback/facebookAdd the following variables to your project's .env file:
FACEBOOK_CLIENT_ID=
FACEBOOK_CLIENT_SECRET=Replace the values with the App ID and App Secret from your Facebook App settings.
[!TIP] Adjust this configuration to use your preferred method for securely storing secrets in CI/CD pipelines.
Import the prebuilt provider component and integrate it into your UI:
import FacebookOAuthButton from "@/components/authverse/FacebookOAuthButton";
<FacebookOAuthButton />;This component renders the Facebook sign-in option at its location.
email, public_profile).https://example.com with your authenticated domain.