pub struct OAuthProviderConfig {
pub client_id: String,
pub client_secret: String,
pub scopes: String,
pub authorize_url: String,
pub token_url: String,
pub userinfo_url: String,
pub style: String,
pub label: String,
pub redirect_uri: String,
pub pkce: Option<bool>,
pub enabled: Option<bool>,
pub icon: String,
}Expand description
One provider’s credentials, and the overrides an unknown provider needs.
Fields§
§client_id: StringThe client id the provider issued. An empty one leaves the provider off, which is what lets a committed config name every provider and a deployment supply only the credentials it has.
client_secret: StringThe client secret. Required for every provider apiplant ships, all of which are confidential clients.
scopes: StringSpace-separated scopes, overriding the built-in default. The defaults ask for the least that identifies somebody; widen this only for scopes the app will actually use, since every one is another line on a consent screen and another reason to press Cancel.
Where the browser is sent to consent. Required for an unknown provider.
token_url: StringWhere the code is redeemed. Required for an unknown provider.
userinfo_url: StringWhere the profile is read. Required for an unknown provider.
style: StringHow to read that profile, for a provider apiplant does not ship:
oidc (default — standard sub/email/email_verified/name/
picture claims, which is what almost everything speaks today) or
github (GitHub’s older shape).
label: StringWhat the sign-in button should say. Defaults to the built-in label, or to the provider’s own name capitalised.
redirect_uri: StringThe redirect URI registered with the provider. Empty (the default)
derives it — <public_url><base_path>/auth/oauth/<provider>/callback —
which is right unless something in front of this server rewrites paths.
pkce: Option<bool>Whether PKCE is used. Unset follows what the provider supports; X requires it, GitHub does not offer it.
enabled: Option<bool>Set false to keep a fully credentialed provider switched off — the way to take a sign-in button away for a while without deleting the secrets.
icon: StringA logo for the sign-in button, as a URL a browser can fetch — usually a
file in public/, such as /oauth/gitlab.svg.
apiplant draws GitHub, Google, LinkedIn and X itself, so this is for the providers it does not ship: without it their button gets the provider’s initial on a plain tile, which works and looks like what it is.
https://github.com/edent/SuperTinyIcons is a good place to get one —
several hundred brand marks, each a few hundred bytes of hand-drawn SVG,
MIT licensed. They are what apiplant’s own four are drawn from. Save the
file into public/ and point this at it.
Implementations§
Trait Implementations§
Source§impl Clone for OAuthProviderConfig
impl Clone for OAuthProviderConfig
Source§fn clone(&self) -> OAuthProviderConfig
fn clone(&self) -> OAuthProviderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more