Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,296 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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.
You may want to try the following; adding the code:
import React, {
useRef,
useEffect,
} from 'react';
import {Login} from '@microsoft/mgt-react';
const Login = () => {
return (
<div className="login">
<Login loginCompleted={(e) => console.log('Logged in')} />
</div>
);
};