# Google OAuth

Google OAuth (Open Authorization) is a secure authorization protocol that allows users to grant third-party applications access to their Google accounts without sharing their usernames and passwords. It is a standard authentication mechanism used by Google to provide secure, delegated access to resources on its platform, including Google Drive, Gmail, Google Calendar, and other services.

OAuth provides a token-based authentication system where users can grant access to their account data without disclosing their credentials to that service. The user first logs in to their Google account and then permits the third-party application to access specific resources using an access token. The application then uses this token to access the authorized resources on the user's behalf without needing the user to provide their login credentials again.

## Configuring Google OAuth

<mark style="background-color:yellow;">Step 1:</mark> Log into the **APIs & Services** page on the Google Cloud platform: <https://console.developers.google.com/apis/credentials>

<mark style="background-color:yellow;">Step 2:</mark> Click the project pulldown menu.&#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FPxhSDtMAzu7ccyPFeBbY%2Fimage.png?alt=media&#x26;token=25c31702-5d07-48f0-9e38-57e47bffdfed" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 3:</mark> Click **NEW PROJECT.**

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FleOiJcWLodXncYL0lvwn%2Fimage.png?alt=media&#x26;token=de070b34-bf4b-4179-be74-05f85aea4e3c" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 4:</mark> Enter a project name and click **Create**.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FidyvVNFm4cUcRmvXcQPX%2Fimage.png?alt=media&#x26;token=cd40beb4-5cde-4e2b-a9a9-39a42a0f3fcb" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 5:</mark> Click the **OAuth consent screen** in the left nav bar.&#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FxtIG6a00Z7jADJBbrhIY%2Fimage.png?alt=media&#x26;token=92f044b9-2384-4cc7-9122-ea96ebb743e9" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 6:</mark> Validate that the user type is "internal" and click **EDIT APP**.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FVy6kHxFwv4icWtAC1sAC%2Fimage.png?alt=media&#x26;token=c370e3e4-00f6-456c-af02-7ba75990ac77" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 7:</mark> Enter a value for the **App name,** select a value for the **User Support email** from the pulldown menu, and enter an email address for the **Developer contact information**. Click **SAVE AND CONTINUE.**

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Fvv2ehFxyGrPsHeFQRgLu%2Fimage.png?alt=media&#x26;token=819f706c-2ce7-4bdc-b371-a63298380189" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step</mark> 8<mark style="background-color:yellow;">:</mark> Click **ADD OR REMOVE SCOPES.**

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FMyD7GGjDjni9rkUPbwUt%2Fimage.png?alt=media&#x26;token=e51b5b4b-656e-43ac-ad5c-a42a3042ee4a" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step</mark> 9<mark style="background-color:yellow;">:</mark> Add the following scopes: email, profile, and openid. Click **Update**.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FAUiFfo80MfLEN3jwfC8Z%2Fimage.png?alt=media&#x26;token=373d246d-f93c-4485-9966-caac83d2752b" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 10:</mark> Click **Credentials** from the left main menu.&#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FlFjoG7Hz8rfAuzdDGRW3%2Fimage.png?alt=media&#x26;token=78b0fb51-d862-4664-8e69-eae92d4d0a50" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step</mark> 11<mark style="background-color:yellow;">:</mark> Click **CREATE CREDENTIALS** and then select **OAuth client ID**.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Freu6CBFbQ9HD5EYvQ3GQ%2Fimage.png?alt=media&#x26;token=5a9f581d-5930-424b-9666-0e622395466a" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step</mark> 12<mark style="background-color:yellow;">:</mark> Select **Web application** as the **Application Type**.&#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Fdq8ObfcyoWHcuqdvtvsN%2Fimage.png?alt=media&#x26;token=a429dd9c-d9ed-4929-be80-ac14e27658d1" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 13:</mark> Click **ADD URI** under the "Authorized JavaScript origins" header and enter the PlexTrac UI URL (i.e., <http://app.plextrac.com).&#x20>;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Fl1OWaANCr1AnEbkM4QF2%2Fimage.png?alt=media&#x26;token=22ae0780-f009-4fc8-b676-0d27d52efd9c" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 14:</mark> Click **ADD URI** from "Authorized redirect URIs," insert the PlexTrac URL, and add "/`api/v2/authenticate/google`" at the end of the url used in Step 10. Click **CREATE**.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Ff9EgFpobOF43G0iEqxus%2Fimage.png?alt=media&#x26;token=5c837464-dc8e-43b5-8d0f-11814a60a1a7" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 15:</mark> Copy the values provided for **Your Client ID** and **Your Client Secret**. Click **Ok**.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FKguE52k8MVJdO4saHYrq%2Fimage.png?alt=media&#x26;token=9708229c-3cf1-41b2-bb3a-c56d9b42699d" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 16:</mark> Log in to PlexTrac as an admin.

<mark style="background-color:yellow;">Step 17:</mark> Navigate to the **Account Admin** page. Click **Security** under "Security & User Management."

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Fw5caAHDPBapzrLpuxVoA%2Fimage.png?alt=media&#x26;token=f1b01bae-7a5e-4238-ba79-a7251a2ab045" alt="" width="429"><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 18:</mark> Click **Authentication Methods** under "Authentication."

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FI9P7z1b7kb18kGMd2XpH%2Fimage.png?alt=media&#x26;token=31a25765-08cc-47ed-a6c2-73846294846a" alt="" width="563"><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 19:</mark> From the **OAuth Providers** tab, select "Google" from the dropdown menu under "Authentication Providers.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FxJSC6f7leTfZLCbOmAa5%2Fimage.png?alt=media&#x26;token=b582e57f-539f-463a-98ee-683180f8790a" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 20:</mark> For the **Provider URL**, enter <https://accounts.google.com>. Enter the **Client ID** value into the "Identifier" field and the **Client Secret** value obtained earlier from previous steps into the "Secret" field. Toggle on the **Enabled** button. Click **Save**. &#x20;

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Ff70J2C2VZ6H8AhG5WHxo%2Fimage.png?alt=media&#x26;token=1f748c99-6a08-41b6-a4b1-a9476736c93e" alt=""><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 21:</mark> Return to "Security & User Management" and click **Users**.

<div align="left"><figure><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2Fd7VYnMbjwqi1Ua93pka5%2Fimage.png?alt=media&#x26;token=a6b106bf-d783-49e8-99ae-9c27602548a7" alt="" width="405"><figcaption></figcaption></figure></div>

<mark style="background-color:yellow;">Step 22:</mark> Under the column header "Authentication Provider," select the desired user and change the value to "Google."&#x20;

<div align="left"><img src="https://4252973360-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXA6EayCcg12qfDcfXd%2Fuploads%2FBq2AyEpge3eZkayF4NmF%2Fimage.png?alt=media&#x26;token=5d6e4940-b337-4bee-8d9e-157eac147f58" alt=""></div>

{% hint style="info" %}
Each user has to be configured individually.
{% endhint %}
