internetdata_oauth (internetdata v1.6.0)
View SourceThe OAuth device flow behind the oauth_* functions on internetdata.
No request made here carries the API key the client was built with, and a client built without one works exactly the same. Every answer is a map whose keys come from a fixed allowlist of atoms; members the server adds later are dropped rather than minted.
Summary
Types
-type metadata() :: #{issuer := binary(), authorization_endpoint := binary(), token_endpoint := binary(), device_authorization_endpoint => binary(), revocation_endpoint => binary(), scopes_supported => [binary()], response_types_supported => [binary()], grant_types_supported => [binary()], code_challenge_methods_supported => [binary()], token_endpoint_auth_methods_supported => [binary()], authorization_response_iss_parameter_supported => boolean(), service_documentation => binary()}.
Functions
-spec device_authorization(map(), binary(), [{binary(), binary()}], map()) -> {ok, device_authorization()} | {error, internetdata_error:error()}.
-spec exchange_device_code(map(), binary(), binary(), map()) -> {ok, token_response()} | {error, internetdata_error:error()}.
-spec exchange_refresh_token(map(), binary(), binary(), map()) -> {ok, token_response()} | {error, internetdata_error:error()}.
-spec metadata(map(), map()) -> {ok, metadata()} | {error, internetdata_error:error()}.
-spec poll_device_token(map(), binary(), device_authorization(), map()) -> {ok, token_response()} | {error, internetdata_error:error()}.
-spec revoke(map(), binary(), binary(), map()) -> ok | {error, internetdata_error:error()}.