Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with google OAuth frontend and backend #17

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ APP_URL=http://localhost
JWT_SECRET=your-jwt-secret-key
JWT_EXPIRATION=3600 # 1 hour in seconds

# Google Config
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret

# XSecurity Config
XSECURITY_ENABLED=false
XSECURITY_SECRET=your-XSecurity-secret
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
### Key Features

- **Authentication**: JWT-based token authentication for secure access.
- **OAuth Integration**: Comprehensive OAuth 2.0 authentication with Google, supporting both backend implementation and frontend token verification.
- **Authorization**: Role- and permission-based access control to manage user privileges.
- **Caching Support**: Integrated Redis caching for enhanced performance.
- **Database Management**: MikroORM setup with PostgreSQL for efficient data handling.
- **Queue Management**: BullMQ for asynchronous tasks and event-driven architecture.
- **Email Notification**: Send emails using [Nodemailer](https://nodemailer.com/) with BullMQ asynchronously.
- **XSECURITY**: [XSECURITY](https://www.npmjs.com/package/nestjs-xsecurity) is an added security layer that safeguards APIs against unauthorized access, ensuring data protection and integrity.
- **Caching Layer**: Redis-powered caching implementation for optimized performance and response times.
- **Database Integration**: Robust PostgreSQL integration using MikroORM with migration support and relationship management.
- **Queue System**: Scalable asynchronous processing using BullMQ for background tasks and event handling.
- **Email Service**: Automated email delivery system utilizing [Nodemailer](https://nodemailer.com/) with templating support and queue integration.
- **Security Framework**: [XSECURITY](https://www.npmjs.com/package/nestjs-xsecurity) provides Enhanced API protection through XSECURITY middleware, implementing rate limiting, XSS prevention, and request validation.
.

## Getting Started Guide Without Docker

Expand Down
82 changes: 80 additions & 2 deletions ims-nest-api-starter.postman_collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
"name": "Health",
"item": [
{
"name": "healthz",
"name": "health",
"request": {
"method": "GET",
"header": [],
"header": [
{
"key": "X-SECURITY-TOKEN",
"value": "eyJleHBpcnkiOjE3MjkyNzc1MDV9.54e13acb80657718fcf9f31075890383ee49e7dfb13e25ffb1b42ac5fbb89324",
"type": "text"
}
],
"url": {
"raw": "{{base_url}}/health",
"host": [
Expand Down Expand Up @@ -53,6 +59,78 @@
{
"name": "Auth",
"item": [
{
"name": "OAuth",
"item": [
{
"name": "google",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/auth/google",
"host": [
"{{base_url}}"
],
"path": [
"auth",
"google"
]
}
},
"response": []
},
{
"name": "google callback",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/auth/google/callback",
"host": [
"{{base_url}}"
],
"path": [
"auth",
"google",
"callback"
]
}
},
"response": []
},
{
"name": "Login by google user id",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\": \"Test Name\",\r\n \"googleId\": \"106475344289988\",\r\n \"email\": \"test@test.com\",\r\n \"accessToken\": \"ya29.a0AeDClZCSARtFggx-4ypKG6mLJdlu4M-IkQBn7qa0JgvhM9xr7hFRvE8IqoRBmNHpIg3FMZyOQE5-dob2Y9aPHQ3UgULShwHku7S1aJxAPDPxGuviCdbfYQDi6yBueAMK6fjVGhlpfQ95EzRmWHjWvqj2zdlc6UsB4GNi6PKiaCgYKAU0SARESFQHGX2MiK_HWDVl4qv3Q0hjko9X_Pw0175\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{base_url}}/api/v1/auth/google/login",
"host": [
"{{base_url}}"
],
"path": [
"api",
"v1",
"auth",
"google",
"login"
]
}
},
"response": []
}
]
},
{
"name": "login",
"request": {
Expand Down
Loading
Loading