> For the complete documentation index, see [llms.txt](https://docs.monogoto.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.monogoto.io/developer/api/how-to-obtain-login-token.md).

# Authentication

## Authenticate your user account to obtain a login token

<mark style="color:green;">`POST`</mark> `https://console.monogoto.io/Auth`

## Generate access token

> Authenticate and generate a JWT access token for subsequent API requests.

```json
{"openapi":"3.0.0","info":{"title":"Monogoto SoftSIM APIs","version":"2.0"},"servers":[{"url":"https://api.monogoto.io"}],"security":[],"paths":{"/v1/auth/token":{"post":{"tags":["Authentication"],"summary":"Generate access token","description":"Authenticate and generate a JWT access token for subsequent API requests.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"type":"string"},"password":{"type":"string","format":"password"}}}}}},"responses":{"200":{"description":"JWT token generated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","description":"JWT Bearer token"},"expires_in":{"type":"integer"}}}}}},"401":{"description":"Invalid username or password."}}}}}}
```

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| UserName<mark style="color:red;">\*</mark> | String | Your username |
| Password<mark style="color:red;">\*</mark> | String | Your password |

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

```json
{
    "token": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng",
    "refreshToken": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXN6lcklkjoiVklkXzg5Y2464OGEyUtND8ThhLTEzZjA0MzJhZDE3YyINTAgsretszgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MD5786bzdhfdzhY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng8vz567dfzgzfgEtT789D43dWEEW",
    "CustomerId": "cid_ecs1d3a5-f5e62a1-fe8af468wf",
    "UserId": "UserId_a76ty5a5-489a-4b87-9b9u-455f451d99fb",
    "UserName": "demo@monogoto.io",
    "Role": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
    "Realm": "customer",
    "OrganizationId": "OrganizationId_235348d7d-dd99-4111-ab2b-1ec612d9b11a",
    "AccountSettings": {
        "TwoFactorAuthentication": false
    },
    "ThingsGroupIds": [],
    "UserProfile": {
        "Permissions": {
            "API": ["view"],
            "AlertsTasksSettings": ["view", "edit", "delete"],
            "ApnAllowedToCustomer": ["view", "edit", "delete"],
            "AuditLogs": ["view"],
            "AuditLogsOwned": ["view"],
            "BillingReports": ["view"],
            "CurrencyCodes": ["view"],
            "Dashboard": ["view", "edit", "delete"],
            "ExternalHLR": ["view"],
            "GlobalSettings": ["view"],
            "IpPools": ["view", "edit", "delete"],
            "MobileSubscriber": ["view", "edit", "delete"],
            "NetwSecSettings": ["view", "edit", "delete"],
            "NetworkProvider": ["view"],
            "NetworkProviderDetails": ["view", "edit", "delete"],
            "PortalAlertsTasksSettings": ["view"],
            "PortalAuditLogs": ["view"],
            "PortalBillingReports": ["view"],
            "PortalDashboard": ["view"],
            "PortalIpPools": ["view"],
            "PortalLogin": ["view"],
            "PortalMobileIdentities": ["view"],
            "PortalNetwork": ["view"],
            "PortalPricePlanDetails": ["view"],
            "PortalRealtimeDashboard": ["view"],
            "PortalRoamingOwned": ["view"],
            "PortalSecurity": ["view"],
            "PortalSettings": ["view"],
            "PortalThings": ["view"],
            "PortalThingsGroups": ["view"],
            "PortalUsers": ["view"],
            "PricePlanDetails": ["view", "edit", "delete"],
            "RoamingOwned": ["view", "edit", "delete"],
            "Settings": ["view"],
            "Tags": ["view", "edit", "delete"],
            "TagsOwned": ["view", "edit", "delete"],
            "Things": ["view", "edit", "delete"],
            "ThingsGroup": ["view", "edit", "delete"],
            "ThingsGroupOwned": ["view", "edit", "delete"],
            "ThingsSensitiveData": ["view", "edit", "delete"],
            "UserProfile": ["view"],
            "Users": ["view", "edit", "delete"],
            "PortalReports": ["view"],
            "ReportTemplate": ["view", "edit", "delete"],
            "ReportHistory": ["view", "edit", "delete"],
            "DownloadReportInPdf": ["view", "edit", "delete"],
            "Scheduler": ["view", "edit", "delete"],
            "PortalScheduler": ["view"],
            "Search": ["view7", "edit", "delete"],
            "DownloadPCAPFile": ["view"],
            "DataLocationService": ["view"],
            "Bundle": ["view", "edit", "delete"]
        },
        "DateCreated": 1550396272390,
        "Name": "Customer Admin",
        "Realm": "customer",
        "Type": "USER_PROFILE",
        "UserProfileId": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
        "DateModified": 1606904198590,
        "cas": "160777788521644"
    }
}

```

{% endtab %}

{% tab title="404: Not Found Access denied" %}

```javascript
{
    Access denied
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Add your **UserName** and **Password** in the POST request to successfully obtain your login token.

```json
{
  "UserName": "string",
  "Password": "string"
}
```

{% endhint %}

### Example using **cURL**:

```bash
curl -X POST \
     --url 'https://console.monogoto.io/Auth' \
     -H 'Content-Type: application/json' \
     -d '{
        "UserName": "string",
        "Password": "string"
        }'
```

Example response showing the **login token**, **CustomerID** etc:

```json
{
    "token": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXNlcklkIjoiVklkXzg5Yj5Y2OGEyUtNDQThhLTEzZjA0MzJhZDE3YyINTAzgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MDY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng",
    "refreshToken": "eyJhb6IkpXVCJ9.eyJSb2xlIjoiVXN4lclByb2ZpbGVJZF9kZGM2MThhNC0wNTI1LTQ2MmUtYWN3NzhhMGQxYmbSI6Im4zgFkbWluIiwiQ3VzdG9tsbCwiVXN6lcklkjoiVklkXzg5Y2464OGEyUtND8ThhLTEzZjA0MzJhZDE3YyINTAgsretszgZmUtZGI51My00ZjRiLTktN2U5Yjc0ZWU1ZThlIiwiaWNzM3MjI5L2MD5786bzdhfdzhY3NTE2Mjl9.99aSLzP7kTgK6TZGW-xalrMu0GkW6viunt3XxbNng8vz567dfzgzfgEtT789D43dWEEW",
    "CustomerId": "cid_ecs1d3a5-f5e62a1-fe8af468wf",
    "UserId": "UserId_a76ty5a5-489a-4b87-9b9u-455f451d99fb",
    "UserName": "demo@monogoto.io",
    "Role": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
    "Realm": "customer",
    "OrganizationId": "OrganizationId_235348d7d-dd99-4111-ab2b-1ec612d9b11a",
    "AccountSettings": {
        "TwoFactorAuthentication": false
    },
    "ThingsGroupIds": [],
    "UserProfile": {
        "Permissions": {
            "API": ["view"],
            "AlertsTasksSettings": ["view", "edit", "delete"],
            "ApnAllowedToCustomer": ["view", "edit", "delete"],
            "AuditLogs": ["view"],
            "AuditLogsOwned": ["view"],
            "BillingReports": ["view"],
            "CurrencyCodes": ["view"],
            "Dashboard": ["view", "edit", "delete"],
            "ExternalHLR": ["view"],
            "GlobalSettings": ["view"],
            "IpPools": ["view", "edit", "delete"],
            "MobileSubscriber": ["view", "edit", "delete"],
            "NetwSecSettings": ["view", "edit", "delete"],
            "NetworkProvider": ["view"],
            "NetworkProviderDetails": ["view", "edit", "delete"],
            "PortalAlertsTasksSettings": ["view"],
            "PortalAuditLogs": ["view"],
            "PortalBillingReports": ["view"],
            "PortalDashboard": ["view"],
            "PortalIpPools": ["view"],
            "PortalLogin": ["view"],
            "PortalMobileIdentities": ["view"],
            "PortalNetwork": ["view"],
            "PortalPricePlanDetails": ["view"],
            "PortalRealtimeDashboard": ["view"],
            "PortalRoamingOwned": ["view"],
            "PortalSecurity": ["view"],
            "PortalSettings": ["view"],
            "PortalThings": ["view"],
            "PortalThingsGroups": ["view"],
            "PortalUsers": ["view"],
            "PricePlanDetails": ["view", "edit", "delete"],
            "RoamingOwned": ["view", "edit", "delete"],
            "Settings": ["view"],
            "Tags": ["view", "edit", "delete"],
            "TagsOwned": ["view", "edit", "delete"],
            "Things": ["view", "edit", "delete"],
            "ThingsGroup": ["view", "edit", "delete"],
            "ThingsGroupOwned": ["view", "edit", "delete"],
            "ThingsSensitiveData": ["view", "edit", "delete"],
            "UserProfile": ["view"],
            "Users": ["view", "edit", "delete"],
            "PortalReports": ["view"],
            "ReportTemplate": ["view", "edit", "delete"],
            "ReportHistory": ["view", "edit", "delete"],
            "DownloadReportInPdf": ["view", "edit", "delete"],
            "Scheduler": ["view", "edit", "delete"],
            "PortalScheduler": ["view"],
            "Search": ["view7", "edit", "delete"],
            "DownloadPCAPFile": ["view"],
            "DataLocationService": ["view"],
            "Bundle": ["view", "edit", "delete"]
        },
        "DateCreated": 1550396272390,
        "Name": "Customer Admin",
        "Realm": "customer",
        "Type": "USER_PROFILE",
        "UserProfileId": "UserProfileId_40e0998a-ef5c-4bbd-a18bc-2864y6100d1",
        "DateModified": 1606904198590,
        "cas": "160777788521644"
    }
}

```

## Authorization Header

{% hint style="info" %}
Once you obtained a token, make sure to add your login token to the the authorization header in all requests.
{% endhint %}

```bash
-H 'authorization: Bearer {YOUR_TOKEN}'
```

**Example**

```bash
curl --request GET \
     --url https://console.monogoto.io/thing/{YOUR_THING_ID}/state \
     -H 'Accept: application/json' \
     -H 'Authorization: Bearer {YOUR_TOKEN}'
```

{% openapi src="/files/lqgrtNg1pOcbxIdacwgh" path="/Auth" method="post" %}
[JPU\_CustomerAPIV\_Without\_Test it.yaml](https://3922449203-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M0mPxGpottOEfcucXOR%2Fuploads%2FXtNpEMk17YOUrC39Cmvr%2FJPU_CustomerAPIV_Without_Test%20it.yaml?alt=media\&token=09b74b38-dd09-4edc-8f98-4df792b3c986)
{% endopenapi %}
