Microsoft Graph Toolkit 增加了新的 Electron 提供程序和一些增强功能

微软近日发布了 Microsoft Graph Toolkit 的 2.1 版本

此次新增了一个专为 Electron 应用程序使用的身份验证提供程序,并包含了现有组件和身份验证提供程序的优化和 bug 修复。

Updating your application

更新我们应用程序中引用的 Microsoft Graph Toolkit 到最新版本,我们只需要执行命令

npm i @microsoft/mgt@latest

如果是以 mgt-loader 的方式调用的,那无需做任何操作

新内容

Electron 提供程序

要使用这个新的提供程序,使用如下命令将它添加到应用程序

npm install @microsoft/mgt-element @microsoft/mgt-electron-provider

在加载时使用如下代码创建提供程序对象

import {Providers} from '@microsoft/mgt-element'; 
import {ElectronProvider} from '@microsoft/mgt-electron-provider/dist/Provider'; 
Providers.globalProvider = new ElectronProvider();

在主函数中初始化认证器

import { ElectronAuthenticator } from '@microsoft/mgt-electron-provider/dist/Authenticator';  
ElectronAuthenticator.initialize({ 
    clientId: '<your_client_id>', 
    mainWindow: mainWindow 
  }; 
);

至此就可以调用 Microsoft Graph 并使用 Microsoft Graph Toolkit 组件了。

其他改进

请查阅 release notes

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值