Outlook Calendar Integration Using Oauth2.0

Microsoft is ending support for basic authentication beginning 1st October 2022. thus we need to change the Authentication to Oauth2.0

 

 

Steps or guidelines to integrate outlook calendar

To integrate outlook calendar with your FreePBX you should have a licensed outlook account (personal or organization account) along with office 365 subscription. And the application needs to be registered with azure portal

Register application in: https://portal.azure.com

Steps to register application in azure portal

  1. Login to https://portal.azure.com using your outlook account which has an office 365 subscription.

  2. After logging in search and select  App Registration in the top search box.

    pasted image 1.png
    pasted image 2.png
  3. Click on new registration.

  4. Enter the following details marked in the screen shot.

    Name: Enter the name of the application as your convenience
    Account Types: Please select second option (Any Azure AD directory - Multitenant)
    Redirect URI: Select the web option from the redirect URI drop down and enter your PBX calendar module’s URI. This is optional at this step you can add this later after registering the application.Click on Register button to register the application
    Note:
    a. The redirect URI should always be your PBX url appended with the calendar module. 
          Ex : https://pbx.domain/admin/config.php?display=calendar
    b. Your PBX domain should HTTPS 

    Note: The HTTPS port should be open only when user trying to generate authorize token while adding Outlook Oauth2 config, once authorization done, they can disable https port if user wish.
             

 

5. After Registering the the application you will get the client details

 

  1. Adding API permissions to the registered application

You can navigate to the API Permissions in the left navigation bar or you can click on Add a certificate or secret link on the below screenshot.

 

After navigating to API permissions click on add permission button to add permissions

 

Select Microsoft Graph -> Delegated Permissions -> select offline_access and Calendars.ReadWrite permissions -> click Add permission button

 

 

 

 

7. After adding permissions Grant admin consent for these permissions (this step is not mandatory). To grant that just click on Grant admin consent button.

 

 

8. Getting client secret key

 

Navigate to Certificates and secrets tab on left menu -> click on New client secret button -> enter description -> select expiration time -> Add

 

When a client secret is added it will show up in the list. Please note the client secrete value somewhere else safely as it is visible for only once after creation.

 

 

Authorizing the PBX to Read calendar events

  1. Ensure FreePBX had HTTPS setup done and login to FreePBX system, Once outlook authorize token generation is done, user can disable to https port if they wish (Not a mandatory for viewing the calendar) Login to system using https and Go to the outlook Config page by clicking on the Outlook Oauth2 Config buttons calendar list page. Then Click on Add Config

     

     

2. Enter all the details which you got by completing the app registration in azure portal.

 

  1. Click on Save.

  2. After saving the credentials, it will redirect to allow api permission page, pls allow them, once done the Authorization button will be enabled.

  3. If you are not getting redirected to allow the permission then Click Authorization button to generate Oath token for Microsoft APIs on clicking Authorize access button it will ask for Microsoft account login and access permission.

  4. Please login with the Microsoft account which has proper office 365 subscription or else the outlook calendar sync will not work. 

  5. On allowing access it redirects back to the calendars module home page.

  6. Select Add Remote Outlook Calendar using Oauth2 from the add calendar dropdown.

 

 

  1. Add an outlook calendar by filling out all the required fields and selecting the outlook config created earlier (after entering the proper email and selecting proper config the users calendars are listed please select the desired calendar or else default  user calendar will be selected automatically). Submit and save calendar

 

10. Go to calendar view and then click on update from source button to sync the calendar.

 

Return to Documentation Home I Return to Sangoma Support