使用Oauth2从Outlook Calendar API获取代码

问题描述 投票:1回答:1

我正在使用.net核心和Angular处理日历API。我使用Google Calendar API完成了所有步骤。现在我想使用Outlook Calendar API来完成它。首先,我需要Angular中的一个函数,所以我可以连接到我的帐户,获得一个代码(Oauth2),我将在后端使用它来获取我的令牌(因为我想在我的数据库中注册它们)。这是我使用Google API的功能

  handleAuthClick() {
    let self = this;
    gapi.auth2.getAuthInstance().grantOfflineAccess()
      .then(value => {
        const optionsParams = {
          params: new HttpParams()
            .set('code', value.code)
        };
        self.http.get("http://localhost:59933/api/UserCode", optionsParams)
          .subscribe(data => {
            console.log(data);
          })
      });
  }

我想我可能需要这个link函数或库?任何人都可以帮助Outlook Calendar API的功能谢谢

angular asp.net-core outlook-calendar
1个回答
1
投票

建议使用Microsoft Graph API访问包括Outlook在内的Microsoft 365服务。

对于Angular,您可以参考教程:Get started with Microsoft Graph and Angular。它在Angular中提供SDK和代码示例。

在GitHub上还有几个Angular例子:https://github.com/search?q=angular+sample+user:microsoftgraph&type=Repositories

此外,您的链接显示使用授权代码流来获取Microsoft Graph API的访问令牌(范围是https://graph.microsoft.com/user.read),您可以在基于javascript的应用程序中使用Implicit Flow。

© www.soinside.com 2019 - 2024. All rights reserved.