cancel
Showing results for 
Search instead for 
Did you mean: 

How to get current user details in CAP

frasie
Advisor
Advisor
0 Kudos

How do I get the current user details (first name and last name) in CAP? So far I do only get the user id in the req.user object.

{
    "id": "<...>",
    "_roles": {
        "any": true,
        "identified-user": true,
        "authenticated-user": true
    },
    "attr": {},
    "tenant": "<...>"
}

I tried to follow this blog:
https://blogs.sap.com/2020/04/06/show-current-user-details-in-cloud-foundry-apps-with-ias/

But the req.user in CAP does not seem to have a token property.

View Entire Topic
sreehari_vpillai
Active Contributor
0 Kudos

below object has the roles , yes -

let myRoles = req._.user.roles ; 

Not sure why , but it returns 3 roles [ any , identified-user , authenticated-user ]