Skip to main content

ProviderSpec

Struct ProviderSpec 

Source
pub struct ProviderSpec {
Show 14 fields pub id: &'static str, pub display_name: &'static str, pub auth_url: &'static str, pub token_url: &'static str, pub userinfo_url: Option<&'static str>, pub scopes: &'static str, pub scope_separator: &'static str, pub client_id_param: &'static str, pub auth_query_extra: &'static str, pub requires_pkce: bool, pub userinfo_method: UserinfoMethod, pub userinfo_parser: UserinfoParser, pub token_exchange: TokenExchangeShape, pub token_response_json: bool,
}
Expand description

Static description of one OAuth/OIDC provider. Endpoint URLs are formatted with {tenant} etc. placeholders that the spec resolves when given a runtime config (e.g. Microsoft swaps {tenant} for the configured Azure tenant id).

Fields§

§id: &'static str

Stable id used in the dashboard URL and the Account.provider column. Lowercase ASCII; matches /api/auth/login/<id>.

§display_name: &'static str

Human-readable name for buttons / UIs.

§auth_url: &'static str

Authorization endpoint — where we send the user to grant access. May contain {tenant} for tenant-aware providers (Microsoft).

§token_url: &'static str

Token exchange endpoint — POST’d with the auth code to get access + refresh tokens.

§userinfo_url: Option<&'static str>

Userinfo endpoint — GET’d with the access token to pull the authed user’s profile. None for providers that put the identity inside the id_token JWT only (Apple).

§scopes: &'static str

OAuth scope string the spec asks for. Defaults to the minimum needed to ID the user. Separator is Self::scope_separator.

§scope_separator: &'static str

Scope separator. RFC 6749 says space; TikTok uses comma.

§client_id_param: &'static str

Form-field name for the OAuth client_id. RFC 6749 says client_id; TikTok says client_key.

§auth_query_extra: &'static str

Extra query parameters appended to the auth URL (already URL-encoded, no leading &). Apple needs response_mode=form_post when name/email scopes are requested; this is the hook for it.

§requires_pkce: bool

PKCE — when true, pylon generates code_verifier / code_challenge (SHA-256, S256), sends the challenge on the auth request, and replays the verifier on token exchange. Twitter/X requires it; Google/Microsoft recommend it.

§userinfo_method: UserinfoMethod

HTTP method used for the userinfo fetch. Most providers use GET; Dropbox uses POST.

§userinfo_parser: UserinfoParser

How to extract (provider_account_id, email, display_name) from the provider’s userinfo response. Provider-stable id path (Google’s sub, GitHub’s id) is what Account keys on, NOT the email — a renamed-email user keeps their account.

§token_exchange: TokenExchangeShape

Provider-specific oddities for token exchange.

§token_response_json: bool

Whether the token endpoint expects an Accept: application/json header (required for GitHub’s classic OAuth, otherwise it returns form-urlencoded). Default true; flip false for providers that explicitly require form encoding.

Trait Implementations§

Source§

impl Clone for ProviderSpec

Source§

fn clone(&self) -> ProviderSpec

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProviderSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more