Helpers for implementing OpenID 2.0 authentication using Steam as the provider.
The flow is as follows:
- A login URL needs to be generated with
generate_login_url/1; this is where you redirect your users to. - The user logs in with Steam as usual, and is then redirected back to the
:callback_urithat was passed togenerate_login_url/1. - In this redirect, Steam will include various query parameters. This payload must be verified
with
verify_callback_payload/2. If the payload was valid, the user's SteamID may be extracted from the payload withextract_claimed_id!/1.
Summary
Functions
Extracts the user's claimed ID (SteamID) from a valid callback payload.
Generates a URL you can redirect your users to for log-in.
Verifies the payload received by the log-in callback endpoint.
Like verify_callback_payload/2, but raises in case of errors.
Types
Functions
@spec extract_claimed_id!(callback_payload()) :: claimed_id()
Extracts the user's claimed ID (SteamID) from a valid callback payload.
This function should only be called with payloads that have been verified by
verify_callback_payload/2.
@spec generate_login_url(login_url_options()) :: URI.t()
Generates a URL you can redirect your users to for log-in.
Options
:callback_uri(URI.t/0) - Required. The URI Steam should redirect back to after a successful log-in.
@spec verify_callback_payload(callback_payload(), [option]) :: {:ok, callback_payload()} | {:error, SteamOpenID.VerifyCallbackPayloadError.t()} when option: {:expected_host, binary()}
Verifies the payload received by the log-in callback endpoint.
Options
:expected_host(String.t/0) - Required. The:hostcomponent of the:callback_uripassed togenerate_login_url/1.
Like verify_callback_payload/2, but raises in case of errors.