# Create a Google App

## Create a New Project

1. Go to <https://console.cloud.google.com/projectcreate>

   You'll see one of these New Project screen options depending on whether your google account is part of an organization (google workspace) or not.

&#x20;   ***New Project view for personal Google accounts***

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FqcBWwKpV73Ov0NDt2KDD%2Fgoogle-project-personal.PNG?alt=media&#x26;token=243db825-3789-4d82-b35f-5d9ad4eb57ac" alt=""><figcaption></figcaption></figure>

***New Project view for Google workspace accounts***

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FWZ6bRs9oNMr7xMhnGVGR%2Fgoogle-project-organization.PNG?alt=media&#x26;token=e523ca87-c3c9-4612-8e9d-da744bbcb1f9" alt=""><figcaption></figcaption></figure>

2. Add a name for your project.
3. For google workspace accounts, select your project's **Organization** and **Location**.
4. Click on the **CREATE** button.

   Once your new project has been created, you'll get a notification that looks like this:

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FY1RTFECF0ZHHtYEWElWK%2Fnew-project-created.PNG?alt=media&#x26;token=369850a7-94d6-484e-90fa-1ce5f072459c" alt=""><figcaption></figcaption></figure>

5. Click the **SELECT PROJECT** link in the notification.

## Enable APIs for Your Project

1. From the Google Cloud dashboard, go to **APIs and Services** on the left menu and then click on  **Enabled APIs and Services**.&#x20;

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FUnv4OM5RA0gdl4CBk0um%2Fapis-and-services.PNG?alt=media&#x26;token=a562cfee-d910-4339-9e1b-fe02e0470544" alt=""><figcaption></figcaption></figure>

2. Click on **+ ENABLE APIS AND SERVICES**

   This should open up the API Library

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FjT2lRqiyERbu15Z3i4Nv%2Fapi-library.PNG?alt=media&#x26;token=29561753-74bb-460c-adbd-e95e1d81fd5d" alt=""><figcaption></figcaption></figure>

3. Search for and enable the following APIs
   1. **Google Calendar API** - required for reading calendars and performing CRUD operations on calendar events.
   2. **Google People API** - required for reading user info such as name and email address.
   3. **Admin SDK API** - required for reading room info for calendar events.

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FPqLqb4L5JxcAP6c1sFpH%2Fgoogle-calendar-api.PNG?alt=media&#x26;token=800ed9b4-6a6e-4d08-a166-a5427a5bac25" alt=""><figcaption></figcaption></figure>

## Configure OAuth Screen

After you've enabled all the APIs, you must configure your Google App's OAuth consent screen. This is the page users will see when authenticating/allowing your app access to their Google account.

1. From the Google Cloud dashboard, hover over **APIs & Services** on the left menu. Then click on **OAuth consent screen**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FhS3QtnFLxzIzOBnxalUc%2Foauth-screen.PNG?alt=media&#x26;token=3c37ed56-31dd-495c-b040-26d8a5317d95" alt=""><figcaption></figcaption></figure>

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2F87Iaco2iSnCM1O1S9Wj0%2Foauth-screen-2.PNG?alt=media&#x26;token=c8e9b7d0-60d3-4b62-bb9b-ec0e245d4d7c" alt=""><figcaption></figcaption></figure>

2. For User Type, choose either **Internal** or **External**, depending on your use case.

   Choose Internal if your app will only be used by users from your organization. Choose External if you want anyone with a Gmail account to be able to use your app. External apps require verification by Google before you can go to production.

### OAuth Screen Steps

1. Fill out all required info for the OAuth screen.
2. Add `pyas.io` to your **Authorized domains** list
3. Add your developer contact email
4. Click on **SAVE AND CONTINUE**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FDSo7oZzLcInGJ1Np4FR7%2Finternal-oauth.PNG?alt=media&#x26;token=61f630e5-81b6-4ad6-802d-384df72d9eab" alt=""><figcaption></figcaption></figure>

5. Next, click **ADD OR REMOVE SCOPES**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FKmluESx2Y4HWYQpLE24j%2Finternal-scopes.PNG?alt=media&#x26;token=ac633665-e913-44ab-8410-239e254a6daf" alt=""><figcaption></figcaption></figure>

6. Copy the scopes below and paste them into the **Manually add scopes** textarea.

&#x20;***Scopes to use:***

```
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
```

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FiuG4wekclGNU8mlz63a1%2Finternal-scopes-add.PNG?alt=media&#x26;token=ea5938bb-17f9-4db2-b661-859bab46689d" alt=""><figcaption></figcaption></figure>

7. Click **ADD TO TABLE** and then click  **UPDATE**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FDXws78nEOCOqNIwMg5fI%2Fscopes-add-2.PNG?alt=media&#x26;token=7a89d14e-a90b-4787-92ef-df8f7ea51952" alt=""><figcaption></figcaption></figure>

8. Click **SAVE AND CONTINUE**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FHQ3MKppKzpU5B5b2wBNz%2Fscopes-3.PNG?alt=media&#x26;token=72d76e05-c7a8-4eb7-b284-d0da27053d77" alt=""><figcaption></figcaption></figure>

9. If you selected **External** for the User Type, the next step will be to add test users. Click the **+ADD USERS** button on the Test users screen.

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FX3nuXIAgwI01MFrtKn8Q%2Ftest-users.PNG?alt=media&#x26;token=958a755b-b76e-4962-9c37-141eee8db49d" alt=""><figcaption></figcaption></figure>

10. Enter up to 100 email addresses for your test users and then click **ADD**.

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FJU2l7Eu2oqewCcpOU2te%2Fadd-users.PNG?alt=media&#x26;token=17a1d982-cff7-4e2f-8acc-86f11c2dae34" alt=""><figcaption></figcaption></figure>

11. Click **SAVE AND CONTINUE**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2F5JG73jnZlB2KDMkLMxe7%2Ftest-users-2.PNG?alt=media&#x26;token=72e62879-d368-4386-a5af-321cc613a218" alt=""><figcaption></figcaption></figure>

12. Review the summary and then click **BACK TO DASHBOARD**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FVwTOZTLVQ0BydDxpwQdl%2Fconsent-summary.PNG?alt=media&#x26;token=8b0c8f43-c6ec-40f2-80e9-3cf35cec8ffd" alt=""><figcaption></figcaption></figure>

13. When you're ready to go to production with your Google App, click the **PUBLISH APP** button.

### Create Credentials

The next thing you need to do is create OAuth credentials for your app. You will need to provide these credentials to Pyas later so we authenticate your users and access their calendars through our API.

1. From the Google Cloud dashboard, under APIs & Services, click on Credentials.

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FKXlxKYqZAXsSaKaIEIHx%2Fcredentials.PNG?alt=media&#x26;token=7adf6164-400b-483f-a00a-d2f7ce97e12b" alt=""><figcaption></figcaption></figure>

2. Click on **CREATE CREDENTIALS** and then select **OAuth client ID**

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FsfvZ7TLaXQBGHTUdA5nC%2Fcredentials-2.PNG?alt=media&#x26;token=f71b4d58-dce7-4cf3-bee7-108170c8a014" alt=""><figcaption></figcaption></figure>

3. For Application Type, select **Web Application**
4. Give your application a name
5. Add authorized redirect URIs.
   1. Be sure to add `https://www.app.pyas.io/org/apps/oauth/google/callback` as an authorized redirect URI
   2. Also add `https://api.pyas.io/oauth/google/callback` as an authorized redirect URI
   3. Add your own redirect URI that you plan on using for your app

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FZgJdlnFFna0kJsg02nsH%2Fcredentials-3.PNG?alt=media&#x26;token=1b7afedd-26b9-4489-8d56-46d8e1938197" alt=""><figcaption></figcaption></figure>

6. Click **CRERATE**
7. There should now be a popup with your OAuth credentials. Save them so you can add them to your Pyas account later.

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FqJHo2qUR9YMWJEEnNckr%2Foauth-created.PNG?alt=media&#x26;token=38b4c73b-6cee-4fa3-9f3b-d28199d52340" alt=""><figcaption></figcaption></figure>

### Add Your Google OAuth Client ID and Client Secret to Pyas

1. Login to your Pyas account
2. Select the Pyas App you will be updating
3. Go to the Pyas App's settings tab
4. Click on Authentication
5. Under **Pyas Authentication**, toggle the **Enable Pyas Auth for Google Accounts** switch off. Then, click the **Save Pyas Auth Settings** button.

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2F74LZNVPlibOO2u4zYnsK%2Fpyas-oauth-google-1.PNG?alt=media&#x26;token=27b95ea9-7d4e-4ef7-9e69-1969c43653ba" alt=""><figcaption></figcaption></figure>

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2F4giQr0toxbROjEkC3Uh1%2Fpyas-oauth-google-2.PNG?alt=media&#x26;token=e5f4e33a-56fd-45d5-9256-f3a222b51cd4" alt=""><figcaption></figcaption></figure>

6. Scroll down to the **Native Google Authentication** section.

<figure><img src="https://703485338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzAOD4a5iAUra2DB1y99h%2Fuploads%2FREcDxU0ak9ep0jmUnUHz%2Fpyas-oauth-google-3.PNG?alt=media&#x26;token=b94bdc7e-5043-409a-aab0-b4b211142c1f" alt=""><figcaption></figcaption></figure>

7. Fill in the **Google Oauth Client ID**, **Google Oauth Client Secret**, and **Google Oauth Callback URL.** Note: the Google Oauth Callback URL should be your authorized redirect url that you added back in the **Create Credentials** section of this guide.
8. Once you've added the Google Oauth info, click the **Save Google Settings** button.

**That's it!** You should now be able to use your Google App with Pyas to add Google Calendar integrations into your app.
