🔒Auth

Connect a Google Account

Get OAuth URL

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

Get an OAuth URL

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

Get a Google 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://accounts.google.com/o/oauth2/v2/auth?..."
}

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, Google will redirect the user back to whatever redirect URL that you've set in Pyas. The URL will contain a code parameter, which we will use in the connect request.

Connect Account

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

Connect Google Account

Headers

NameTypeDescription

x-api-key*

String

API key

Request Body

NameTypeDescription

code*

String

code returned from Google OAuth

name*

String

user's full name

{
    "success": true,
    "data": {
        "account": {
            "accountId": "3a39a739-4269-4565-b6ed-97757b5ebffc-po08qu",
            "email": "some-user@gmail.com",
            "name": "John Doe",
            "provider": "google",
            "status": "active",
            "scopes": [
                "https://www.googleapis.com/auth/userinfo.email",
                "https://www.googleapis.com/auth/userinfo.profile",
                "openid",
                "https://www.googleapis.com/auth/calendar.events",
                "https://www.googleapis.com/auth/calendar.freebusy",
                "https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly",
                "https://www.googleapis.com/auth/calendar.calendarlist.readonly",
                "https://www.googleapis.com/auth/calendar.calendars.readonly"
            ]
        }
    }
}

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

Last updated