Changelog - 2026-06-18
Current User Information Endpoint
New FeatureIn one line. The generated auth controller now wires up a GET /me profile endpoint and an opt-in ?withUserInformation=true flag on GET /who-am-i, both backed by the optional IAuthService.getUserInformation method that previously had no route.
What changed
- New route:
GET /me- registered bydefineAuthController, returns the result ofIAuthService.getUserInformation. - Updated route:
GET /who-am-i?withUserInformation=true- when the flag is truthy, the response gains auserInformationfield alongside the existing JWT payload. - JWT-protected - both routes require a valid access token (
Authentication.STRATEGY_JWT), same as the rest of the auth controller. - Optional service hook -
IAuthService.getUserInformation?(context, opts)returns501 Not Implementedif the application's auth service does not implement it. - Customizable response schema - via
payload.getUserInformation.response.schemaondefineAuthController. - OpenAPI updated - the
who-am-iresponse schema documents the optionaluserInformationfield.
Who is affected
- Applications that don't implement
getUserInformationon their auth service - no action needed. Both/meand/who-am-i?withUserInformation=truecleanly return501 Not Implemented; the default/who-am-iresponse is unchanged. - Applications that already implement
getUserInformation- no action needed to keep current behavior, but you now get a working/meendpoint and the/who-am-imerge flag for free. Optionally setpayload.getUserInformation.response.schemafor OpenAPI documentation. - Frontend clients - can fetch a standalone profile via
GET /me, or merge it into the existing/who-am-iprincipal by adding?withUserInformation=true.
Details
Implement the hook to return whatever profile shape the application needs:
typescript
class MyAuthService implements IAuthService {
async getUserInformation(context, _opts) {
const current = context.get(Authentication.CURRENT_USER);
return this.userRepository.findById({ id: current.userId });
}
}Optionally document the response shape:
typescript
defineAuthController({
// ...
payload: {
getUserInformation: { response: { schema: GetUserInformationResponseSchema } },
},
});GET /who-am-i?withUserInformation=true accepts true, false, 1, or 0 for the flag, coerced to a boolean, and merges the result under a userInformation key on top of the existing principal.