Sovite.SASL.OAuthBearer (sovite v0.2.0)

Copy Markdown View Source

The OAUTHBEARER mechanism (RFC 7628): the client sends an OAuth 2.0 bearer token (RFC 6750) instead of a password.

n,a=user@example.com,^Aauth=Bearer <token>^Ahost=...^Aport=...^A^A

(^A is the byte 0x01.) The token is checked by the backend's verify_token/3. When it is rejected, the server sends a JSON error as a challenge, the client answers with 0x01, and the exchange fails (RFC 7628 §3.2.3).

Summary

Functions

Starts the client side. credentials has :username and :token, and optionally :host and :port of the server.

Answers the server's error challenge with 0x01, as RFC 7628 requires.

Functions

client_start(credentials)

@spec client_start(map()) :: {:ok, binary(), term()}

Starts the client side. credentials has :username and :token, and optionally :host and :port of the server.

client_step(atom, arg2)

@spec client_step(term(), binary()) :: {:ok, binary(), term()}

Answers the server's error challenge with 0x01, as RFC 7628 requires.