> For the complete documentation index, see [llms.txt](https://foodmonkey-docs.natadtech.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://foodmonkey-docs.natadtech.com/define-basics/google-authentication.md).

# Google Authentication

Here's how to activate Google login.

Visit [Google API Console](https://console.developers.google.com/).

Create a new project or select an existing one if you've already set one up.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2FKgOPQPYAYS9zdiOeZdRI%2Fnatadtechgapi1.jpg?alt=media&amp;token=3fb50ac5-d0db-478c-9489-28247e219294" alt=""><figcaption></figcaption></figure>

Then, access the Library from the left-hand menu.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2FL3pmZEcXvg4cSLW3Kg0c%2Fgoogleauth.jpg?alt=media&amp;token=d204df44-2a20-4519-aebb-b9c15f7b40d0" alt=""><figcaption></figcaption></figure>

Locate the Google+ API and click on it.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2FyxxGxheFbBjofYnj3evX%2Fgoogleauthapi.jpg?alt=media&amp;token=2efa95bf-0de9-43ce-ac7b-d3dfbe36cfc9" alt=""><figcaption></figcaption></figure>

Activate the Google+ API.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2Finie0vXD06LMGGwV6JsP%2Fgoogleauthenable.jpg?alt=media&amp;token=57e3d6c7-10f5-4f6d-91c9-15899b1ed68e" alt=""><figcaption></figcaption></figure>

Now, after enabling the API, navigate to the **OAuth consent screen** from the left-hand menu and choose **External**.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2FL6UDRWi0QPvVORdP4IqI%2Fgoogleauthconsent.jpg?alt=media&amp;token=d20495ad-d0b5-4bdb-a168-c4bcade87b0a" alt=""><figcaption></figcaption></figure>

Then, fill in the required information related to your domain project and click **Save**.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2FIBoNJmYBYkK6zGfayBJk%2Fgoogleauthconsentscreen.jpg?alt=media&amp;token=9cfabfdc-0a32-44ae-8709-08f15eb8e3a0" alt=""><figcaption></figcaption></figure>

Proceed to the **Credentials** section from the left-hand menu, click on **Create Credentials**, and select **OAuth client ID**.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2FR2NhyGSG77Cy31vZM0jc%2Fgoogleauthcredentials.jpg?alt=media&amp;token=d1ad83f5-1aaf-4ce0-bcf7-4d84188b2c2d" alt=""><figcaption></figcaption></figure>

Choose **Web application** and input the relevant details for your project's domain.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2Fs2d4K3RnKo0pa6Qvqkhz%2Fgoogleauthwebapp.jpg?alt=media&amp;token=7ec98bcc-8046-4799-a944-58dddd49cec8" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Note\
Ensure that your domain matches the one specified in the **OAuth consent screen.**\
Additionally, the redirect route should match the one defined in the picture.

***<https://yourdomain.com/login/google/redirect>***
{% endhint %}

{% hint style="info" %}
If you encounter issues with authorizing your domain, access the **authorized domains list** and include your domain.
{% endhint %}

Click on **Create** and then copy the provided credentials into the .env file.

<figure><img src="https://3774121173-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHgqItXoDo5myLGaKMahI%2Fuploads%2FWir8by2VQ3qltKSr230I%2Fgoogleauthcreateclient.jpg?alt=media&amp;token=3aee9bba-4325-45ee-8cb2-db48676dc95e" alt=""><figcaption></figcaption></figure>

```
GOOGLE_CLIENT_ID="" //Used for google login
GOOGLE_CLIENT_SECRET="" //Used for google login
GOOGLE_REDIRECT="" //Used for google login
```
