<commit_before>---
layout: post
title: Authentication
excerpt: Credentials and token-based authentication
---

Validation of credentials is done through the `session` resource, whose URL is
given by the `login` relation type at the API entry point:

    {
      "api": {
        ...
        "links": {
          "login": "https://demo.travel-intelligence.com/api/v1/session"
        }
      }
    }


The `JSON` resource representation is formatted as follows:

    {
      "session": {
        "email": "<EMAIL>",
        "password": "<PASSWORD>",
        "auth_token": "<PASSWORD>"
      }
    }

The client of the API must provide `email` and `password` for validation.
Upon successful authentication the service replies with an `auth_token`.

    $ curl -v https://demo.travel-intelligence.com/api/v1/session \
      -H 'Content-Type: application/json' \<commit_msg>Explicit HTTP POST request for authentication.<commit_after>---
layout: post
title: Authentication
excerpt: Credentials and token-based authentication
---

Validation of credentials is done through the `session` resource, whose URL is
given by the `login` relation type at the API entry point:

    {
      "api": {
        ...
        "links": {
          "login": "https://demo.travel-intelligence.com/api/v1/session"
        }
      }
    }


The `JSON` resource representation is formatted as follows:

    {
      "session": {
        "email": "<EMAIL>",
        "password": "<PASSWORD>",
        "auth_token": "<PASSWORD>"
      }
    }

The client of the API must provide `email` and `password` for validation by
sending a HTTP POST request.
Upon successful authentication the service replies with an `auth_token`.

    $ curl -v https://demo.travel-intelligence.com/api/v1/session \
      -H 'Content-Type: application/json' \
{'fraction_non_alphanumeric': 0.12028824833702882, 'fraction_numerical': 0.0022172949002217295, 'mean_word_length': 2.6317907444668007, 'pattern_counts': {'":': 14, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4873309', 'n_tokens_mistral': 525, 'n_tokens_neox': 493, 'n_words': 169}