# Authentiction with Gmail

## Step 1: Obtain Password&#x20;

If you choose to register to Opentact with your Gmail account, Opentact will send you an email with your password.  Here is how the email looks like:

<figure><img src="/files/Rs13dtAcTb1IKhrAAX2j" alt=""><figcaption></figcaption></figure>

## Step 2: Generate Base64 Key

Next, you will take your gmail and password above to generate a base64 key using the following command in Linux:

```
echo -n 'testuser@gmail.com:18aec2c0-1e9c-48d9-b7a2-363063a153ff' | base64 

```

You should obtain from the above command a token like this:

```
dGVzdHVzZXJAZ21haWwuY29tOjE4YWVjMmMwLTFlOWMtNDhkOS1iN2EyLTM2MzA2M2ExNTNmZg==
```

> You can revert the token with the following command:
>
> echo -n 'dGVzdHVzZXJAZ21haWwuY29tOjE4YWVjMmMwLTFlOWMtNDhkOS1iN2EyLTM2MzA2M2ExNTNmZg==' | base64 -d
>
> <testuser@gmail.com>:18aec2c0-1e9c-48d9-b7a2-363063a153ff%

## Step 3: Generate API Token

You can use the following command to generate API token which you can use to execute Openatct APIs:

{% code overflow="wrap" %}

```
curl https://api.opentact.org/rest/auth --header 'Authorization: Basic aW5oZXJpdGVkYXJ0c0BnbWFpbC5jb206MThhZWMyYzAtMWU5Yy00OGQ5LWI3YTItMzYzMDYzYTE1M2Zm'
```

{% endcode %}

Here is an example output:

{% code overflow="wrap" %}

```
{
  "success": true,
  "payload": {
    "created_on": "2020-10-19T05:32:33.415Z",
    "modified_on": "2024-02-27T07:41:48.945Z",
    "uuid": "4521f972-dcc7-4755-be99-dacc1892abb4",
    "email": "alexey.matvienko@gmail.com",
    "phone_number": "343434334",
    "first_name": "Алексей",
    "wss_online": false,
    "last_name": "М",
    "avatar": "https://s3.opentact.org/avatar/4521f972-dcc7-4755-be99-dacc1892abb4.png",
    "dob": null,
    "role": "User",
    "gender": null,
    "deleted_on": null,
    "token": "eyJhbGciOiJIUzR5cCI6IkpXVCJ9.eyJ1dWlkIjoiNDUyMWY5Ny00NzU1LWJlOTktZGFjYzE4OTJhYmI0Iiwicm9sZSI6IkFkbWluIiwiZG9tYWluIjoib3BlbnRhY3Qub3JnIiwixNzA5NTM0OTc1LCJleHA2MjEzNzQeUPpllWBc7hyvpt063VuVJMOeFPFmbFq4k",
    "account": {
      "created_on": "2020-09-28T09:20:22.830Z",
      "modified_on": "2020-10-02T05:59:55.196Z",
      "uuid": "4c1645f4-8be8-4f6d-a4ff-f0ac33ed6ada",
      "email": "info@denovolab.com",
      "name": "DENOVOLAB",
      "phone": 87015260731,
      "level": "Level2",
      "address1": null,
      "address2": null,
      "zip_code": null,
      "city": null,
      "deleted_on": null,
      "disabled_on": null,
      "balance": 0
    }
  }
}// Some code
```

{% endcode %}

&#x20;The token you used above can be used for executing Opentact API.

{% code overflow="wrap" %}

```
"token": "eyJhbGciOiJIUzR5cCI6IkpXVCJ9.eyJ1dWlkIjoiNDUyMWY5Ny00NzU1LWJlOTktZGFjYzE4OTJhYmI0Iiwicm9sZSI6IkFkbWluIiwiZG9tYWluIjoib3BlbnRhY3Qub3JnIiwixNzA5NTM0OTc1LCJleHA2MjEzNzQeUPpllWBc7hyvpt063VuVJMOeFPFmbFq4k",// Some code
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.opentact.org/opentact-api-documentation/overview/authentication-api/authentiction-with-gmail.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
