Expand description
API clients and scopes, as the PHP package’s ResolveClient and AuthorizeScopes middleware
and ApiKey model provide them.
Each request to an API route is resolved to an ApiClient, or to a guest. With the
database feature, Authorization: Bearer fs_live_… and fs_test_… keys from the api_keys
table are resolved by the crate itself; Config::client_resolver
adds your own authentication, which runs first. A client’s pinned version is used when a request
has no Api-Version header. Routes ask for scopes with RequiresScope.
Structs§
- ApiClient
- Who made a request.
- Requires
Scope - Route middleware that requires the client to have a scope, as
#[RequiresScope]does in PHP. Guests get a 401unauthenticated, and clients without the scope a 403insufficient_scope.
Functions§
- client
- The client a request was authenticated as, or
Nonefor a guest. - resolver
- Wraps an async function as a
ClientResolver.
Type Aliases§
- Client
Resolver - Your own authentication: given the request’s headers, the client they authenticate, or
Noneto try the next way (the crate’s API keys) and then treat the request as a guest’s.