Closed kamrankhatti closed 4 years ago
Since token returns "user_id": 9
then use that to request user details /users?id=9
Else there is no point of doing what you want to do. It is worthless IMHO
It would be a separate call I just want user info in same oauth response anyways I have found a workaround you can see the details here. There should be a workaround within oauth2 server it should have been flexible to add new fields in response array without modifying the core files, just like QueryParamAuth
and HttpBearerAuth
we extend it and modify according to our needs.
I wan to customize default Oauth2 access token generation response from this:
{ "access_token": "f3389e81c234276967079b2293795fc9104a2fac", "expires_in": 86400, "token_type": "Bearer", "user_id": 9, "scope": null, "refresh_token": "851464a210f56bb831da378a43e1016bd3e765d7", }
to this
{ "access_token": "f3389e81c234276967079b2293795fc9104a2fac", "expires_in": 86400, "token_type": "Bearer", "scope": null, "refresh_token": "851464a210f56bb831da378a43e1016bd3e765d7", "user": { "id": 9, "first_name": "Test", "last_name": "Test2", "username": "test", "email": "test@gmail.com", "status": 1, "dob": "20-08-1990", "gender": "Male", } }
for further details visit this @mtangoo @RoyXiang @damiandennis @freezy-sk @wenbin1989