mgt logged in user

Christophe Humbert 101 Reputation points

I am using the Login component of the Microsoft graph Toolkit (React flavor). How can I retrieve the display name and UPN of the logged in user?

I see that the component has a loginCompleted prop, but the user is not passed as argument.

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

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,256 Reputation points Microsoft Employee

    You may want to try the following; adding the code:

    import React, {
    } from 'react';
    import {Login} from '@microsoft/mgt-react';
    const Login = () => {
      return (
        <div className="login">
          <Login loginCompleted={(e) => console.log('Logged in')} />
    0 comments No comments