MukeshKapoor25 commited on
Commit
918926f
·
1 Parent(s): 6beca64

feat(auth): enhance jwt token response with additional user data

Browse files

Include more user information in the JWT token response to provide client applications with necessary user details like profile picture, auth method, and provider information.

Files changed (1) hide show
  1. app/services/user_service.py +12 -1
app/services/user_service.py CHANGED
@@ -257,4 +257,15 @@ class UserService:
257
  }
258
 
259
  access_token = jwt.encode(token_data, settings.SECRET_KEY, algorithm=settings.ALGORITHM)
260
- return {"access_token": access_token}
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
258
 
259
  access_token = jwt.encode(token_data, settings.SECRET_KEY, algorithm=settings.ALGORITHM)
260
+ return {
261
+ "access_token": access_token,
262
+ "token_type": "bearer",
263
+ "expires_in": 28800,
264
+ "user_id": user_id,
265
+ "name": data.name,
266
+ "email": data.email,
267
+ "profile_picture": user_doc.get("profile_picture"),
268
+ "auth_method": data.mode,
269
+ "provider": data.provider if data.mode == "oauth" else None,
270
+ "security_info": None
271
+ }