Current section
Files
Jump to
Current section
Files
lib/campaign_flow/client/auth.ex
defmodule CampaignFlow.Client.Auth do
@moduledoc """
Handles OAuth2 authentication for the Campaign Flow API.
This module manages OAuth2 client credentials flow for obtaining access tokens.
"""
@token_url_path "/oauth2/v1/token"
@doc """
Builds the OAuth2 token URL from the base URL.
"""
@spec build_token_url(String.t()) :: String.t()
def build_token_url(base_url) do
# Remove /api/v2 suffix if present and add oauth2 path
base_url
|> String.replace(~r{/api/v2$}, "")
|> Kernel.<>(@token_url_path)
end
end