简体   繁体   中英

How to integrate outlook calendar API and fetch the events from outlook calendar in flutter?

我想集成 Outlook 日历 API 并从 Outlook 日历中获取事件并将它们添加到我的 flutter 应用程序中,但我找不到任何合适的指南来执行此操作,所以我的问题是如何将 Outlook 日历 API 集成到我的 flutter 应用程序中。

First, you add o auth2 Client pub package

https://pub.dev/packages/oauth2_client

class Something{

    Future fetchOutlookCalender(
      {BlockCreateCustomTaskBucket provider}) async {

    var client = OAuth2Client(
        authorizeUrl:
            'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
        tokenUrl: 'https://login.microsoftonline.com/common/oauth2/v2.0/token',
        redirectUri: 'com.example.upticker://oauth2redirect',
        customUriScheme: 'com.example.upticker');

    var token = await client.getTokenWithAuthCodeFlow(
        clientId: '32502b36-55b3-44b7-88ab-cf8d0ce273dc',
        scopes: ['openid profile offline_access user.read calendars.read']);
     print('accesstoken: '${token.accessToken}',')
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM