# Auth

## User Actions

## User login

<mark style="color:green;">`POST`</mark> `https://api.colorboration.tk/auth/login`

#### Request Body

| Name                                       | Type   | Description        |
| ------------------------------------------ | ------ | ------------------ |
| email<mark style="color:red;">\*</mark>    | String | Email for Login    |
| password<mark style="color:red;">\*</mark> | String | Password for Login |

{% tabs %}
{% tab title="200: OK successful operation" %}

```javascript
{ 
    "accessToken": accessToken,
    "message": "ok"
}
```

{% endtab %}

{% tab title="500: Internal Server Error sever error" %}

```javascript
```

{% endtab %}

{% tab title="401: Unauthorized Invalid email/password supplied" %}

```javascript
{
    "message": "Invalid email or password"
}
```

{% endtab %}
{% endtabs %}

## User logout

<mark style="color:green;">`POST`</mark> `https://api.colorboration.tk/auth/logout`

#### Headers

| Name                                     | Type   | Description          |
| ---------------------------------------- | ------ | -------------------- |
| cookie<mark style="color:red;">\*</mark> | String | Sending Access Token |

{% tabs %}
{% tab title="205: Reset Content successful operation" %}

```javascript
{
    "message": "successfully signed out!"
}
```

{% endtab %}

{% tab title="500: Internal Server Error sever error" %}

```javascript
```

{% endtab %}
{% endtabs %}

## SignUp

<mark style="color:green;">`POST`</mark> `https://api.colorboration.tk/auth/signup`

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| email<mark style="color:red;">\*</mark>    | String | user email    |
| password<mark style="color:red;">\*</mark> | String | user password |
| name<mark style="color:red;">\*</mark>     | String | user name     |

{% tabs %}
{% tab title="201: Created successful operation" %}

```javascript
{
    "message": "ok"
}
```

{% endtab %}

{% tab title="500: Internal Server Error sever error" %}

```javascript
```

{% endtab %}

{% tab title="409: Conflict " %}

```javascript
{
    "message": "email already exists"
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity " %}

```javascript
{
    "message": "insufficient parameters supplied"
}
```

{% endtab %}
{% endtabs %}

## Validate a name

<mark style="color:green;">`POST`</mark> `https://api.colorboration.tk/auth/name`

#### Request Body

| Name | Type   | Description     |
| ---- | ------ | --------------- |
| name | String | Validate a name |

{% tabs %}
{% tab title="200: OK successful operation" %}

```javascript
{
    "message": "ok"
}
```

{% endtab %}

{% tab title="500: Internal Server Error sever error" %}

```javascript
{
    // Response
}
```

{% endtab %}

{% tab title="409: Conflict already exist" %}

```javascript
{
  "message": "name already exists"
}
```

{% endtab %}
{% endtabs %}

## Get a Access Token from Google

<mark style="color:blue;">`GET`</mark> `https://api.colorboration.tk/auth`

#### Request Body

| Name                                                | Type   | Description        |
| --------------------------------------------------- | ------ | ------------------ |
| authorizationCode<mark style="color:red;">\*</mark> | String | Authorization Code |

{% tabs %}
{% tab title="200: OK Cake successfully retrieved." %}

```javascript
{ 
    access_token: "************************_thMjcA56EGzv_oJiTuaxEu1tQlfljKTbfuRr0KiOgaYCuJ90a_P6TUNlmfTdCW6RFvA0AaBCJVxWPP_TkbHezEpZ5Af6plhZykqGLSVL7I7UGC9S2u***********",
    expires_in: 3598, 
    id_token: "*******************I6ImY0MTk2YWVlMTE5ZmUyMTU5M2Q0OGJmY2ZiNWJmMDAxNzdkZDRhNGQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiOiI3MTIwNzgzNTkwMDItbXM1Ym8zaDAzdGVub2NqYjhzaWI5bWRxNnE0NmpkZXQuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhdWQiOiI3MTIwNzgzNTkwMDItbXM1Ym8zaDAzdGVub2NqYjhzaWI5bWRxNnE0NmpkZXQuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJzdWIiOiIxMDUyOTY0NzMyMzc1MTY1MDE4MzYiLCJlbWFpbCI6ImVoZGRucjQ4NzBAZ21haWwuY29tIiwiZW1haWxfdmVyaWZpZWQiOnRydWUsImF0X2hhc2giOiJhQWtSSEhpNVY4eXQ3V3BXdUpQYjRBIiwibmFtZSI6IuydtOuPmeyasSIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS0vQU9oMTRHajlpVUFrczlKYjR5T3FWZnJzaENseWZhM2ZPNEtWTF9aTW14N2ZfUT1zOTYtYyIsImdpdmVuX25hbWUiOiLrj5nsmrEiLCJmYW1pbHlfbmFtZSI6IuydtCIsImxvY2FsZSI6ImtvIiwiaWF0IjoxNjMzOTM2NzA5LCJleHAiOjE2MzM5NDAzMDl9.YnZlpAkVbU6uojYx3RG3rJEIr7aSwiZ_x9uZBaJHCdpuyP8jqApmjEfthqy4MiUiI2l6E3JhFbJl07Mp69ezQ16eQ1YgnvpIOArE8H7WYHrbqm2hkBAWrvrVJF8RnGaSB1hRO0xsjTcY3FIOhKeFKkSMvrwpIzaQxwl1FPeKm5H1HfpjLrM9CC1W--EFKedxkqPaAnzftHqPetFrQakJvIyTbU2GT4Hp4zryUL4SyubXSKD_RLjEOkpP683vu5r2B1Bi5NSBIMs9iJVptXBz1MPC_hFTUNHEtORfXs8***************************", 
    scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid", 
    token_type: "Bearer"
}
```

{% endtab %}
{% endtabs %}


---

# 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://joshua-3.gitbook.io/colorboration-api-document/auth.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.
