1

I want to integrate outlook calendar API and fetch the events from outlook calendar and add them into my flutter app but I can't find any proper guide to do this so my question is how I can integrate outlook calendar API in my flutter app.

Rohit Kurzekar
  • 81
  • 1
  • 11
  • You can try to use [retrofit](https://pub.dev/packages/retrofit) or [chopper](https://pub.dev/packages/chopper) to communicate with Outlook Calendar API(as with any other API). Have you tried this? – konstantin_doncov Mar 28 '20 at 21:25

1 Answers1

1

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}',')
}
OmG
  • 18,337
  • 10
  • 57
  • 90
Rao Saqib
  • 11
  • 2