microsoft-graph-toolkit

How to use mgt-people-picker in react framework

痴心易碎 提交于 2021-01-29 14:46:38
问题 I'm trying to use mgt-people-picker inside my SPFx Webpart with React framework, and couldn't get the selected-people attribute work. I tried passing an array of graph user objects to it but no luck. When I tried to use document.querySelector('mgt-people-picker').selectUsersById(["id","id"]) it threw an error saying "Property 'selectUsersById' does not exist on type 'Element'" The documentation is quite limited and unclear and there isn't much reference that I could find. Can anyone tell me

It is mandatory to use the login component in order to use the other components

我只是一个虾纸丫 提交于 2021-01-28 12:00:29
问题 I'm developing an application in React, I'm using MSAL for the application login and once the user is authenticated I want to use the card component of a person but I can't make it work. I tell you what I have implemented in case I forgot some steps. I have added the following tag in the component itself: <mgt-msal-provider client-id={process.env.REACT_APP_MSALCLIENTID}></mgt-msal-provider> where that client I'm using on MSal to authenticate the user. I have also tried to define it in the

Validating a Microsoft Graph JWT Token

十年热恋 提交于 2021-01-01 13:34:29
问题 I'm by no means an expert on MSAL/JWT/Graph authentication, but I'm hoping someone can explain this issue more clearly to me, or help me understand if there's a workaround or better approach. Essentially, there are certain scenarios where I might end up with a Microsoft Graph JWT token. Two examples I can think of easily are using the Microsoft Graph Toolkit or using Tabs SSO in Microsoft Teams. In both cases, I can get relevant identity information for the user from the JWT token I would

Validating a Microsoft Graph JWT Token

被刻印的时光 ゝ 提交于 2021-01-01 13:30:25
问题 I'm by no means an expert on MSAL/JWT/Graph authentication, but I'm hoping someone can explain this issue more clearly to me, or help me understand if there's a workaround or better approach. Essentially, there are certain scenarios where I might end up with a Microsoft Graph JWT token. Two examples I can think of easily are using the Microsoft Graph Toolkit or using Tabs SSO in Microsoft Teams. In both cases, I can get relevant identity information for the user from the JWT token I would

Validating a Microsoft Graph JWT Token

爷,独闯天下 提交于 2021-01-01 13:29:54
问题 I'm by no means an expert on MSAL/JWT/Graph authentication, but I'm hoping someone can explain this issue more clearly to me, or help me understand if there's a workaround or better approach. Essentially, there are certain scenarios where I might end up with a Microsoft Graph JWT token. Two examples I can think of easily are using the Microsoft Graph Toolkit or using Tabs SSO in Microsoft Teams. In both cases, I can get relevant identity information for the user from the JWT token I would

Working example for Graph Toolkit using SharePoint spfx, React and Get component with template

若如初见. 提交于 2020-12-15 05:41:29
问题 I'm trying to make use of the Microsoft Graph Toolkit inside my SharePoint spfx web part solution, and more specifically the React version (@microsoft/mgt-react). I've managed importing the packages, and also render the control correctly. However I am now trying to render controls based on the result from a control. Something like this: const MyPerson = (props: MgtTemplateProps) => { const { person } = props.dataContext; return <Person userId={person.userPrincipalName}></Person>; } And here

How to use MgtTeamsChannelPicker in React?

三世轮回 提交于 2020-07-09 19:57:11
问题 I imported all necessary libs. import "@microsoft/mgt"; import "@microsoft/teams-js" put tag MgtTeamsChannelPicker into my render section render() { return ( <MgtTeamsChannelPicker></MgtTeamsChannelPicker> ); } than i got an error. 回答1: Due to how react handles custom elements, they must be referenced differently. Alternatively you can use our wrapper here: https://github.com/nmetulev/mgt-react which will allow you to reference the component in the following way: import { TeamsChannelPicker }

Event handlers of Microsoft Graph Toolkit components not called in React app

眉间皱痕 提交于 2020-07-09 08:07:59
问题 I am trying to use the login component from the Microsoft Graph Toolkit in my React app. It works fine, but I cannot seem to be able to make any of the events fire. For example - import React from "react"; import { MgtLogin, Providers, MsalProvider } from "@microsoft/mgt"; import "./App.css"; Providers.globalProvider = new MsalProvider({ clientId: "a974dfa0-9f57-49b9-95db-90f04ce2111a" }); function handleLogin() { console.log("login completed"); } function App() { return ( <div className="App

Event handlers of Microsoft Graph Toolkit components not called in React app

 ̄綄美尐妖づ 提交于 2020-07-09 08:04:58
问题 I am trying to use the login component from the Microsoft Graph Toolkit in my React app. It works fine, but I cannot seem to be able to make any of the events fire. For example - import React from "react"; import { MgtLogin, Providers, MsalProvider } from "@microsoft/mgt"; import "./App.css"; Providers.globalProvider = new MsalProvider({ clientId: "a974dfa0-9f57-49b9-95db-90f04ce2111a" }); function handleLogin() { console.log("login completed"); } function App() { return ( <div className="App

Microsoft Graph toolkit component mgt-login event is not called in React App with hooks

烈酒焚心 提交于 2020-06-29 03:59:50
问题 I have implemented mgt-login component from Microsoft Graph toolkit, it is working fine but it's not calling event I added to mgt-login within useEffect. Duplicate question here - I did follow this question but still its not calling event I added. Here is code for that component import React, { useRef, useEffect, } from 'react'; const Login = () => { const loginComponent = useRef(null); useEffect(() => { loginComponent.current.addEventListener('loginCompleted', () => console.log('Logged in!')