SyphtClient v0.1.0 SyphtClient.Auth View Source

Acquires and caches Sypht access tokens.

Configuration

Override these defaults in the :sypht_client section of your config.exs files.

  • auth_url: "https://login.sypht.com/oauth/token" - URL of token acquisition end point
  • auth_ttl: 84_600_000 - Token TTL milliseconds. Sypht tokens last for 24 hours - reacquire after 23 hours 30 minutes
  • auth_retry_on: [500] - Retry token acquisition on server HTTP status
  • auth_initial_backoff: 200 - Initial backoff milliseconds
  • auth_retry_until: 30_000 - Continue backing off and retrying until this many milliseconds have elapsed
  • auth_http_options: [ssl: [{:versions, [:"tlsv1.2"]}]] - Hackney HTTP options for authentication
  • auth_error_prefix: "SyphtAuth failed:" - Prefix authentication error messages with this

Link to this section Summary

Functions

Gets an access token using the client ID and secret in the environment variable SYPHT_API_KEY. Caches and subsequently returns any tokens acquired from Sypht for :auth_ttl milliseconds. Returns {:ok, sypht_bearer_token} if successful, {:error, reason_string} otherwise.

Link to this section Functions

Gets an access token using the client ID and secret in the environment variable SYPHT_API_KEY. Caches and subsequently returns any tokens acquired from Sypht for :auth_ttl milliseconds. Returns {:ok, sypht_bearer_token} if successful, {:error, reason_string} otherwise.