This repository contains a full-stack application that integrates Discord OAuth2 for authentication with Firebase to manage authenticated sessions. The system is divided into two main parts:
- Backend (
discord-auth-backend
): Implemented with NestJS, it handles Discord OAuth2 authentication, user data retrieval, and Firebase custom token generation. - Frontend (
discord-auth-frontend
): Built with React, it utilizes Firebase to authenticate users based on the tokens generated by the backend and manage user sessions.
.
├── discord-auth-backend # Backend service using NestJS
│ ├── src
│ │ ├── app.controller.ts # Handles incoming requests
│ │ ├── app.service.ts # Business logic for Discord authentication
│ │ └── ...
│ └── package.json
├── discord-auth-frontend # Frontend service using React
│ ├── src
│ │ ├── App.tsx # Main React component
│ │ ├── auth # Authentication related components
│ │ └── ...
│ └── package.json
└── README.md # Repository documentation
- Node.js
- Yarn or npm
- Firebase project
- Discord Developer Account
-
Clone the repository
git clone https://github.com/nawodyaishan/discord-firebase-auth.git cd discord-firebase-auth
-
Set up the backend
cd discord-auth-backend yarn install # Configure environment variables in .env file yarn start
-
Set up the frontend
cd ../discord-auth-frontend yarn install # Configure environment variables in .env file yarn start
Ensure you have the necessary Discord credentials and Firebase configuration details set up in your environment variables or configuration files for both the backend and frontend services.
Navigate to http://localhost:3000
(or your configured frontend URL) to access the application and test the authentication flow using Discord.
Contributions are welcome! Please feel free to submit a pull request or open issues to improve the documentation or code.