Backend API for MettaChain PropChain with Facebook OAuth2 authentication.
- Facebook OAuth2 Login
- User profile management
- Account linking
- Profile synchronization
-
Install dependencies:
npm install
-
Configure Facebook OAuth2:
- Go to Facebook Developers
- Create a new app or use existing one
- Add Facebook Login product
- Get your App ID and App Secret
- Set the callback URL to:
http://localhost:3000/auth/facebook/callback
-
Create
.envfile with your configuration:FACEBOOK_APP_ID=your_facebook_app_id FACEBOOK_APP_SECRET=your_facebook_app_secret SESSION_SECRET=your_random_session_secret PORT=3000 -
Start the server:
npm start
Or for development:
npm run dev
GET /auth/facebook- Initiate Facebook OAuth2 loginGET /auth/facebook/callback- OAuth2 callback (handled automatically)GET /logout- Logout user
GET /profile- Get current user profile (requires authentication)POST /auth/link-facebook- Link Facebook account to existing userPOST /auth/sync-profile- Sync user profile with Facebook
- Start the server
- Visit
http://localhost:3000/auth/facebookin your browser - Complete Facebook login
- You'll be redirected to
/profilewith user data
- ✅ OAuth2 config (Facebook app setup and environment variables)
- ✅ Login endpoint (
/auth/facebook) - ✅ Account linking (
/auth/link-facebook) - ✅ Profile sync (
/auth/sync-profile)