How to see users logged-in using Spa

Bhuvan Goyal 20 Reputation points
2024-07-30T07:58:25.68+00:00
  • Req. -> Want to see users that have logged in using my SPA
  • Link Used -> https://learn.microsoft.com/en-gb/entra/identity-platform/tutorial-single-page-app-react-register-app
    used this link to create SPA app(React)
  • Supported Account Type -> Image Attached
    (Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox))
  • Api Permission -> Image Attached
    ["openid", "profile", "User.Read", "AuditLog.Read.All", "Directory.Read.All"]
  • Token Access ->
    1. Access tokens (used for implicit flows)
      1. ID tokens (used for implicit and hybrid flows)
  • AuthCinfig.ts -> export const loginRequest = {
    scopes: ["openid", "profile", "User.Read", "AuditLog.Read.All", "Directory.Read.All"]
    
    };
  • Redirected URI -> Redirect URI matches the one in your msalConfig
  • PFA
    Token and Support Acoount

Api Permission

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,993 questions
Microsoft Entra
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
23,149 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 45,106 Reputation points
    2024-07-30T09:23:04.5866667+00:00

    Hi @Bhuvan Goyal

    You can retrieve the list of users who have logged into your single-page app by calling the /auditLogs/signIns endpoint and filtering the returned result set using the given single-page app ID.

    GET https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=appId eq '{spa_id}'
    

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.