adk_oauth_adapter behaviour (erlang_adk v0.7.0)

View Source

Adapter behaviour for outbound OAuth token endpoint operations.

Summary

Types

opts/0

-type opts() :: #{scope := [binary()], resource => binary()}.

provider/0

-type provider() :: gen_server:server_ref().

token/0

-type token() ::
          #{access_token := binary(),
            expires_in_ms := pos_integer(),
            token_type => binary(),
            refresh_token => binary()}.

Callbacks

client_credentials/4

-callback client_credentials(Provider :: provider(),
                             ClientId :: binary(),
                             ClientSecret :: binary(),
                             Opts :: opts()) ->
                                {ok, token()} | {error, term()}.

refresh_token/6

-callback refresh_token(Provider :: provider(),
                        ClientId :: binary(),
                        ClientSecret :: binary(),
                        RefreshToken :: binary(),
                        ExpectedSubject :: binary(),
                        Opts :: opts()) ->
                           {ok, token()} | {error, term()}.