🔒Auth

Connect an Outlook Account

Get OAuth URL

There are 2 steps for connecting a Microsoft Outlook account. The first step is to request a Microsoft OAuth URL.

Get an OAuth URL

GET https://api.pyas.io/microsoft/oauth

Get a Microsoft OAuth URL

Query Parameters

NameTypeDescription

email*

String

a user's email address

state

String

optional application state

Headers

NameTypeDescription

x-api-key*

String

API key

{
    "success": true,
    "url": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=..."
}

Connect Account

The next step is to connect the account. After you get an OAuth URL, you should direct your user to that URL in the browser. The user will then have to authorized/allow access on the OAuth screen. Once the user allows access, Microsoft will redirect the user back to whatever redirect URL that you've set in Pyas. The URL will contain a code parameter, which you will need to use in the connect request.

Connect Account

POST https://api.pyas.io/microsoft/connect

Connect Microsoft Account

Headers

NameTypeDescription

x-api-key*

String

API key

Request Body

NameTypeDescription

code*

String

code returned from Microsoft OAuth

name*

String

user's full name

{
    "success": true,
    "data": {
        "account": {
            "accountId": "03fdd65-d25f-4f00-94e3-9c23ea99738-56321c14",
            "email": "example@outlook.com",
            "name": "Jon Snow",
            "provider": "microsoft",
            "status": "active",
            "scopes": [
                "openid",
                "offline_access",
                "profile",
                "https://graph.microsoft.com/User.Read",
                "https://graph.microsoft.com/Calendars.Read",
                "https://graph.microsoft.com/Calendars.Read.Shared",
                "https://graph.microsoft.com/Calendars.ReadWrite",
                "https://graph.microsoft.com/Calendars.ReadWrite.Shared",
            ]
        }
    }
}

Note: Be sure to save the accountId returned from the successful connect request. You will need it in order to access the user's Outlook calendar.

Last updated