> For the complete documentation index, see [llms.txt](https://api.govtech.esempla.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.govtech.esempla.systems/sso/api.md).

# API

## Generarea Token

<mark style="color:blue;">`GET`</mark> `https://sso.esempla.systems/api/v1/login`

#### Path Parameters

| Name          | Type   | Description                                    |
| ------------- | ------ | ---------------------------------------------- |
| Authorization | string | <p>Metoda de audentificare<br>"Basic Auth"</p> |

#### Request Body

| Name     | Type   | Description                   |
| -------- | ------ | ----------------------------- |
| Username | string | Numele Secret al Organizatiei |
| Password | string | Tokenul Secret al Proectului  |

{% tabs %}
{% tab title="200 Exemplu rezultatului corect" %}

```javascript
{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6IjEifQ.eyJpc3MiOiIxIiwiYXVkIjoiMSIsImp0aSI6IjEiLCJpYXQiOjE1NTI5MDQwNzgsIm5iZiI6MTU1MjkwNDA3OCwiZXhwIjoxNTUyOTA3Njc4fQ.a0mJq1GZH6N4Tx3Gzrc5m8l7MlXvtfi4NlmcKca1Rm4"
}
```

{% endtab %}

{% tab title="401 Problema in autorizarea
Este setat incorect Username, Password." %}

```
{
    "name": "Unauthorized",
    "message": "Your request was made with invalid credentials.",
    "code": 0,
    "status": 401
}
```

{% endtab %}

{% tab title="404 Problema in metoda, este setata incorect." %}

```javascript
{
    "name": "Not Found",
    "message": "Page not found.",
    "code": 0,
    "status": 404,
    "previous": {
        "name": "Invalid Route",
        "message": "Unable to resolve the request \"v1/logi\".",
        "code": 0
    }
}
```

{% endtab %}
{% endtabs %}

## Inspectam Organizatia si Proectul care apartine tokinului

<mark style="color:blue;">`GET`</mark> `https://sso.esempla.systems/api/v1/checkToken`

#### Path Parameters

| Name          | Type   | Description                                      |
| ------------- | ------ | ------------------------------------------------ |
| Authorization | string | <p>Metoda de audentificare<br>"Bearer Token"</p> |

#### Request Body

| Name  | Type   | Description                                                  |
| ----- | ------ | ------------------------------------------------------------ |
| Token | string | indicam tokenul care a fos creat prin metoda "/api/v1/login" |

{% tabs %}
{% tab title="200 Exemplu rezultatului corect" %}

```
{
    "status": true,
    "organization": {
        "name": "TES1",
        "idno": "123",
        "status_id": 1,
        "description": "",
        "project": "test"
    }
}
```

{% endtab %}

{% tab title="401 Problema in Token, este setat incorect." %}

```
{
    "name": "Unauthorized",
    "message": "Your request was made with invalid credentials.",
    "code": 0,
    "status": 401
}
```

{% endtab %}

{% tab title="404 Problema in metoda, este setata incorect." %}

```
{
    "name": "Not Found",
    "message": "Page not found.",
    "code": 0,
    "status": 404,
    "previous": {
        "name": "Invalid Route",
        "message": "Unable to resolve the request \"v1/checkToke\".",
        "code": 0
    }
}
```

{% endtab %}
{% endtabs %}
