This project is a NestJS application that allows users to authenticate using their Steam account and retrieve their profile and inventory data.
-
Clone the repository:
git clone https://github.com/HDTN/steam-login-app.git cd steam-login-app
-
Install dependencies:
pnpm install
-
Set up environment variables: Create a
.env
file in the root directory and add your Steam API key and session secret:STEAM_API_KEY=your_steam_api_key_here SESSION_SECRET=your_session_secret
-
Start the application:
pnpm start
-
Navigate to
https://localhost:3000/auth/steam
to initiate the Steam login process. -
Check the profile and inventory endpoints:
curl https://localhost:3000/auth/profile/{steamId} curl https://localhost:3000/steam/inventory/{steamId}
src/ ├── auth/ │ ├── auth.controller.ts │ ├── auth.module.ts │ ├── auth.service.ts │ └── steam.strategy.ts ├── steam/ │ ├── steam.controller.ts │ ├── steam.service.ts │ └── steam.module.ts ├── main.ts └── app.module.ts
- auth.controller.ts: Handles the authentication routes.
- auth.module.ts: Authentication module.
- auth.service.ts: Contains business logic for validating and fetching user data from Steam.
- steam.strategy.ts: Passport strategy for Steam OpenID authentication.
- steam.controller.ts: Handles the inventory routes.
- steam.service.ts: Contains business logic for fetching user inventory from Steam.
- main.ts: Entry point of the application.
- app.module.ts: Root module of the application.
GET /auth/steam
: Initiates Steam login.GET /auth/steam/return
: Callback endpoint for Steam login.GET /auth/success
: Endpoint to confirm successful login.GET /auth/profile/:steamId
: Fetches the user's Steam profile.GET /steam/inventory/:steamId
: Fetches the user's CS2 inventory.
STEAM_API_KEY
: Your Steam API key. You can get it from Steam Web API Key.SESSION_SECRET
: A secret key for session encryption.
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Make your changes.
- Commit your changes:
git commit -m 'Add feature name'
- Push to the branch:
git push origin feature-name
- Create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to customize this README according to your project's requirements.