API Token

Upon faraday v3.9 we included an API Token for our api. The token for the API will expire when the user changes the password.

You can configure token expiration in the [server] section of the configuration with the option api_token_expiration expressed in seconds.

Token expires by timeout or when the user changes the password. Each token is associated to the user who requests the token.

This is a example request of how to obtain a token

curl --user USER:PASSWORD http://localhost:5985/_api/v2/token/
"eyJhbGciOiJIUzUxMiIsImlhdCI6MTYxOTAzMTU3OCwiZXhwIjoxNjIxNjIxNzc4fQ.eyJ1c2VyX2lkIjoiZjNjYTUyNjYtOWU2ZS00NzQwLWI0NWItN2Y2M2JkZWMzN2UwIiwidmFsaWRhdGlvbl9jaGVjayI6IiQ1JHJvdW5kcz01MzUwMDAkVDZ3cy9ZMGFHUW10UnEzSSRpRS5OSG1oaDNWR0h4VXIudVpRNGRnaEVVUXFiS09pWGg5VGdrTURtQXIwIn0.gu6AgQ-iIvdnrHBphBfzWopn5B21D_RvTFvltcoMnksAj0eHhfh7dkJW4GfjhZPQd02RBAsb3vvUUCA0fORvfw"

Now that you got the auth token you can start using it on every request to the api:

curl 'http://localhost:5985/_api/v2/ws/' -H 'Authorization:Token AUTH_TOKEN' -H 'Content-Type: application/json'