Client
The main purpose of the client module is facilitate HTTP communication from client applications to a server, or from a server to other servers.
The two modes of operation are documented in the ActivityPub specification as the Social API and, respectively the Federation Protocol.
As opposed to a regular http.Client object, which deals with http.Request
type inputs and http.Response outputs, the client module deals directly with
the vocab.IRI and vocab.Item objects, the intermediary steps of building
requests and handling the responses being handled automatically for the calling
code.
HTTP Authorization
OAuth2 for client to server requests
In order to authorize the user for the case of the client to server requests the module can use OAuth2 bearer tokens. The c2s subpackage offers a compatibility layer with an OAuth2 client external library.
The official source documentation has an example for requests using the OAuth2 authorization mechanism.
HTTP-Signatures for server to server requests
For the server to server requests it can use HTTP-Signatures in both RFC9421 and Cavage Draft versions using the helpers in the s2s subpackage.
The module can use the double knocking mechanism which attempts both of the signatures versions for the same request.
In the official source documentation you can find examples for both of these methods (Draft and RFC9421).