feat(auth): Implement Google OAuth 2.0 integration with user creation and JWT generation

- Added Google OAuth controller and service to handle authentication via Google.
- Introduced DTOs for Google user and token responses.
- Updated AuthService and UsersService traits to support new Google OAuth functionality.
- Implemented logic to create a new user if they do not exist in the system after Google authentication.
- Enhanced existing user retrieval and JWT generation upon successful login.
- Added tests for Google OAuth flow, including login redirection and callback handling for both new and existing users.
- Updated environment configuration to include Google OAuth credentials.
This commit is contained in:
MythEclipse
2025-08-11 22:31:51 +07:00
parent c6a95c1231
commit cda950ed7e
22 changed files with 1144 additions and 104 deletions
+5 -1
View File
@@ -1,3 +1,4 @@
use axum::Router;
use imphnen_gateway::gateway_service;
use imphnen_libs::axum_init;
@@ -5,7 +6,10 @@ use imphnen_libs::axum_init;
async fn main() {
env_logger::init();
axum_init(|surrealdb_ws, surrealdb_mem| async {
gateway_service(surrealdb_ws, surrealdb_mem).await
let app = gateway_service(surrealdb_ws, surrealdb_mem).await;
let mut router = Router::new();
router = router.nest("/api/v1/auth", imphnen_iam::v1::auth::auth_router());
app.merge(router)
})
.await;
}