README.md

# couchdb_auth

Authentication helpers for the Apache CouchDB REST API, written in Elixir.

* Tested with:
  - Elixir 1.18.x / Erlang OTP 27
  - CouchDB 3.x

# Overview

Apache CouchDB REST API client for Elixir.

Small, focused API surface that builds pre-configured `Tesla.Client`s for the
main CouchDB interfaces.

### Features

* HTTP REST client
* HTTP Authentication:
  * Basic Auth
  * Cookie Auth
  * OAuth

## Installation

Add to mix.exs

```elixir
  def deps do
    [{:couchdb_auth, "~> 0.2.1"}]
  end
```

## Usage

Set required parameters in `config/*.exs` or via environment variables using the
`COUCHDB_` prefix (for example `COUCHDB_PROTOCOL`, `COUCHDB_HOSTNAME`, ...).

To send authorized request to db server(default port 5984) use next:

`CouchDB.client() |> CouchDB.get("/_session")`

or to send request to backend server(default port 5986):

CouchDB.client(:backend) |> CouchDB.get("/_session")

About configuring OAuth, you can read this:

https://develixir.blogspot.com/2017/06/configuring-oauth-10-authentication.html