GameServer.OAuth.Exchanger (GameServer v1.0.509)

Default implementation for exchanging OAuth codes with providers.

This module is intentionally small and works with the Req library. Tests may replace the exchanger via application config for easier stubbing.

Summary

Functions

exchange_apple_code(code, client_id, client_secret, redirect_uri, opts \\ [])

@spec exchange_apple_code(String.t(), String.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

exchange_discord_code(code, client_id, client_secret, redirect_uri, opts \\ [])

@spec exchange_discord_code(String.t(), String.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

exchange_facebook_code(code, client_id, client_secret, redirect_uri, opts \\ [])

@spec exchange_facebook_code(
  String.t(),
  String.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, map()} | {:error, term()}

exchange_google_code(code, client_id, client_secret, redirect_uri, opts \\ [])

@spec exchange_google_code(String.t(), String.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, term()}

exchange_steam_code(code)

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

exchange_steam_ticket(ticket, opts \\ [])

@spec exchange_steam_ticket(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Verify a Steam auth ticket using ISteamUserAuth/AuthenticateUserTicket/v1

Expects a ticket (binary blob) returned by the Steamworks client SDK. Returns {:ok, user_info} on successful verification or {:error, reason} on failure.

get_player_profile(steamid)

Fetch a public Steam profile for a given steamid using GetPlayerSummaries. Returns {:ok, map} or {:error, reason}.