atozas-social-media-login
v1.0.0
Published
Complete social media authentication package with Google and Facebook OAuth for React and Node.js - Ready to use solution
Maintainers
Readme
AtoZas Social Media Login
🚀 Complete social media authentication package with Google and Facebook OAuth for React and Node.js. Ready-to-use solution that can be installed via npm and set up in minutes!
🚀 Installation
npm install atozas-social-media-login⚡ Quick Setup
Method 1: Using CLI (Recommended)
# Install globally
npm install -g atozas-social-media-login
# Initialize project
atozas-auth init
# Start development
atozas-auth devMethod 2: Manual Setup
# Clone or download
git clone https://github.com/atozas/social-media-login.git
cd social-media-login
# Interactive setup
npm run setup
# Install dependencies
npm run install-deps
# Start development
npm run dev🎯 Features
✅ Google OAuth 2.0 - Complete Google login integration
✅ Facebook OAuth - Full Facebook authentication
✅ React Frontend - Modern, responsive UI
✅ Node.js Backend - Secure Express server
✅ Session Management - Secure user sessions
✅ CORS Protection - Cross-origin security
✅ Easy Configuration - Simple .env setup
✅ CLI Tools - Command-line interface
✅ Production Ready - Optimized for deployment
📁 Project Structure
atozas-social-media-login/
├── bin/cli.js # CLI commands
├── lib/auth-middleware.js # Authentication middleware
├── client/ # React frontend
│ ├── src/components/ # Login & Dashboard components
│ └── package.json # Client dependencies
├── server/ # Node.js backend
│ ├── server.js # Express server
│ └── package.json # Server dependencies
├── setup.js # Interactive setup
└── .env.example # Environment template🔧 Configuration
Get OAuth Credentials
Google OAuth Setup:
- Visit Google Cloud Console
- Create new project → Enable Google+ API
- Create OAuth 2.0 credentials
- Add redirect URI:
http://localhost:5000/auth/google/callback
Facebook OAuth Setup:
- Visit Facebook Developers
- Create new app → Add Facebook Login
- Add redirect URI:
http://localhost:5000/auth/facebook/callback
Environment Variables
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
FACEBOOK_APP_ID=your_facebook_app_id
FACEBOOK_APP_SECRET=your_facebook_app_secret
SESSION_SECRET=your_random_session_secret
CLIENT_URL=http://localhost:3000
SERVER_URL=http://localhost:5000🎮 Usage
CLI Commands
atozas-auth init # Initialize project with dependencies
atozas-auth dev # Start development mode (both servers)
atozas-auth start # Start production server
atozas-auth help # Show help menuProgrammatic Usage
const AtoZasAuth = require('atozas-social-media-login/lib/auth-middleware');
const auth = new AtoZasAuth({
googleClientId: 'your-google-client-id',
googleClientSecret: 'your-google-secret',
facebookAppId: 'your-facebook-app-id',
facebookAppSecret: 'your-facebook-secret'
});
app.use('/auth', auth.getRoutes());🔌 API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /auth/google | Initiate Google OAuth |
| GET | /auth/google/callback | Google OAuth callback |
| GET | /auth/facebook | Initiate Facebook OAuth |
| GET | /auth/facebook/callback | Facebook OAuth callback |
| GET | /auth/user | Get current user profile |
| POST | /auth/logout | Logout user |
🛠️ Technologies
Frontend:
- React 18 + React Router
- Axios for API calls
- Modern CSS styling
Backend:
- Node.js + Express.js
- Passport.js authentication
- Session management
- CORS protection
🔒 Security Features
✅ Secure session management
✅ CORS protection
✅ Environment variable protection
✅ OAuth 2.0 standard compliance
✅ XSS protection
✅ CSRF protection
📱 Demo
After setup, visit http://localhost:3000 to see:
- Clean login interface
- Google & Facebook login buttons
- User dashboard with profile info
- Secure logout functionality
🤝 Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
📄 License
MIT License - see LICENSE file for details.
🆘 Support
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 📖 Docs: Documentation
⭐ Show Your Support
Give a ⭐️ if this project helped you!
Made with ❤️ by AtoZas Team
