LLMProxy.Providers.OpenAICodex.OAuth.Login (llm_proxy v0.1.0)

Copy Markdown View Source

Interactive OpenAI Codex OAuth login for standalone LLMProxy releases.

The browser-facing OAuth protocol returns JSON/string-keyed provider data. This module owns that external boundary and converts successful token responses into LLMProxy.Providers.OpenAICodex.OAuth credentials for storage.

Summary

Types

post_fun()

@type post_fun() :: (String.t(), keyword() ->
                 {:ok, Req.Response.t()} | {:error, term()})

Functions

account_id(jwt)

@spec account_id(String.t()) :: String.t() | nil

authorize_url(challenge, state, originator \\ "llm_proxy")

@spec authorize_url(String.t(), String.t(), String.t()) :: String.t()

exchange_code(code, verifier, post_fun \\ &Req.post/2)

@spec exchange_code(String.t(), String.t(), post_fun()) ::
  {:ok, LLMProxy.Providers.OpenAICodex.OAuth.t()} | {:error, term()}

new_state()

@spec new_state() :: String.t()

new_verifier()

@spec new_verifier() :: String.t()

parse_authorization_input(input, state)

@spec parse_authorization_input(String.t(), String.t()) ::
  {:ok, String.t()} | {:error, term()}

parse_token_response(body)

@spec parse_token_response(map() | String.t()) ::
  {:ok, LLMProxy.Providers.OpenAICodex.OAuth.t()} | {:error, term()}

pkce_challenge(verifier)

@spec pkce_challenge(String.t()) :: String.t()