Can I add the user.officelocation claim for OAuth registered app in Azure AD? If I add it in its service principal in Enterprise Apps ? Will it work ? Do I get office location of users (synced users) in Access token? Or i need to configure something else (office location field is blank in user properties)in user' profile? My app has user.read.all scope granted.
Yes, you can use Azure AD access token to get office location of users.
In the Azure AD application and updated the manifest:
In the Enterprise application added claim like below:
Granted API permissions:
I generated the access token and the office location claim displayed successfully:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/authorize?client_id=ClientID&response_type=token&redirect_uri=https://jwt.ms&scope=api://xxx/claims.read&state=12345&nonce=12345
Note that: If the user doesn't have the office location updated then the claim will not be returned in the access token.
Make sure that the office location attribute is sync'd or update it in user properties:
Go to Azure Portal -> Users -> Edit properties