In my custom rest resource, I want to identify the user who made the API call. Since API call includes Authorization header with access token, can I get the user from this value?
Just use the
UserInfo class, which:
Contains methods for obtaining information about the context user.
Specifically, you can get their
Id runningUserId = UserInfo.getUserId(); String runningUserName = UserInfo.getName(); String runningUserUsername = UserInfo.getUsername();