Getting offline status for all users if logged in on the tenant as a guest user account

Jitendra Patidar 20 Reputation points
2023-10-15T03:31:05.08+00:00

I have used Microsoft Graph API in my SPFx solution. We are fetching users from Azure AD and then fetching their Presence. When I log in using my organization account of the same tenant, it works as expected but if I log in using the guest user account, it returns the Offline status for all users.

I found that using SPFx it assigns the Delegate access to the Microsoft Graph API, so I have added Presence.ReadWrite.All with Application type. In principle now it should work for the guest user as well as I have assigned the access as Application type but still it is returning the Offline status for all users.

User's image

Furthermore, I have also set the Guest users access same as normal users as shown in the images below,:

User's image

Still it is not working. Any thoughts?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,821 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Carolyne-3676 201 Reputation points
    2023-10-18T18:53:23.2933333+00:00

    With the guest account, it is likely that token you get may not have the appropriate permissions to access the said scope. You can check the token's permissions by decoding the token using a JWT decoder such JWT decoder(https://jwt.ms/) and looking for the scp attribute. Check for the Presence.Read or Presence.Read.All scope and if it does not exist, it might explain why you are running into this issue.

    To remedy this issue, you need to grant the appropriate permission to the guest account. You can do this by adding the required permission in the Azure AD app registration and then granting consent to the guest account.

    Here are some links to the Microsoft documentation that can help you with this: