Get user information
To retrieve detailed user information, we recommend using the email provided in the OAuth bearer token to query the Apps Facade API, which is a part of Open OS.
Here's an example of user data embedded in the Open OS JWT token.
{
...
"scope": "email profile",
"email_verified": true,
"name": "Some User",
"preferred_username": "[email protected]",
"given_name": "Some",
"family_name": "User",
"email": "[email protected]"
}
In a Java + Spring Boot 3.0 application, you can extract the user email from the authenticated user as follows.
ofNullable(SecurityContextHolder.getContext().getAuthentication())
.filter(JwtAuthenticationToken.class::isInstance)
.ifPresent(authentication -> {
Jwt principal = (Jwt) authentication.getPrincipal();
String userEmail = (String) principal.getClaims().get("email");
...
});
To obtain more detailed information about the current user, you can use the GET /api/users/me endpoint of the Apps Facade API.
You can retrieve current user details from the Apps Facade API using the following curl terminal command.
curl -X 'GET' \
'https://apps-facade-api-prd-one.os.wpp.com/' \
-H 'accept: application/json' \
-H 'authorization: Bearer <your_user_bearer_token>' \
An example response may look like this.
{
"data": {
"id": "db55fe45-bd0f-420f-b64c-d63880c68487",
"sourceId": "b3b9222d-1942-4e95-9cb1-66475b7e5677",
"sourceType": "OKTA",
"firstname": "Jane",
"lastname": "Doe",
"email": "[email protected]",
"active": true,
"agency": "wpp",
"country": "United States",
"country_iso": "US",
"department": "IT",
"avatarUrl": null,
"avatarOriginal": {
"key": "40dd4cbe-d5fa-4d44-92e2-3fb99259b36a-profile.jpeg",
"name": "profile.jpeg",
"size": 13266
},
"avatarThumbnail": {
"key": "b3838dff-cb83-4261-80f0-121b6d59bc15-avatar_1692012895035.png",
"name": "avatar_1692012895035.png",
"size": 255070
},
"jobTitle": "DevOps",
"officeLocation": "Sacramento",
"createdAt": "2023-08-09T14:54:41.919770+00:00",
"updatedAt": null,
"feedsLastSeenDatePerTenant": {},
"mdProperties": [
{
"mdType": "AGENCY",
"mdId": "17cb7d66-ca05-4bb8-bb2c-e0a01144eda2"
}
],
"preferredTenantId": null,
"displayLanguage": "en-US",
"dateLocale": "en-gb",
"numberLocale": "en-gb",
"tags": [],
"editProfileLink": "https://wpp.okta.com/enduser/settings"
},
"errors": null
}
This provides more comprehensive user details, including the full name, country, department, job title, and office location, among others.