Skip to main content

OAuthProvider

Struct OAuthProvider 

Source
pub struct OAuthProvider {
Show 24 fields pub client_id: String, pub client_secret: String, pub client_key: Option<String>, pub auth_url: String, pub token_url: String, pub token_endpoint_auth: Option<TokenEndpointAuth>, pub user_info_url: Option<String>, pub redirect_uri: Option<String>, pub end_session_endpoint: Option<String>, pub post_logout_redirect_uri: Option<String>, pub scopes: Option<Vec<String>>, pub disable_default_scope: bool, pub disable_id_token_sign_in: bool, pub prompt: Option<String>, pub authorization_params: Vec<(String, String)>, pub map_user_info: Option<fn(Value) -> Result<OAuthUserInfo, String>>, pub map_profile_to_user: Option<Arc<dyn OAuthProfileMapper>>, pub get_user_info: Option<Arc<dyn OAuthUserInfoHandler>>, pub refresh_access_token: Option<Arc<dyn OAuthRefreshTokenHandler>>, pub verify_id_token: Option<Arc<dyn OAuthIdTokenVerifier>>, pub disable_implicit_sign_up: Option<bool>, pub disable_sign_up: Option<bool>, pub require_email_verification: Option<bool>, pub override_user_info_on_sign_in: bool, /* private fields */
}
Expand description

Input options for a social OAuth provider. Constructors retain omitted options.

Fields§

§client_id: String§client_secret: String§client_key: Option<String>

Additional key for built-in authorization-code exchanges that accept this option.

§auth_url: String§token_url: String§token_endpoint_auth: Option<TokenEndpointAuth>

Cloudflare token endpoint authentication override for code exchange and refresh. Other Social providers retain their fixed authentication methods.

§user_info_url: Option<String>§redirect_uri: Option<String>

Provider callback URI for authorization and code exchange; an empty value uses the route URI.

§end_session_endpoint: Option<String>

OIDC provider endpoint used for RP-initiated logout.

§post_logout_redirect_uri: Option<String>

Default redirect after provider logout; a request callback overrides it.

§scopes: Option<Vec<String>>

Additional scopes for built-in providers; omission preserves their defaults.

§disable_default_scope: bool

Exclude the built-in provider scopes from authorization requests.

§disable_id_token_sign_in: bool

Reject direct ID-token sign-in and linking before invoking the verifier.

§prompt: Option<String>

Authentication prompt for providers that support this option. Omission preserves the provider default.

§authorization_params: Vec<(String, String)>§map_user_info: Option<fn(Value) -> Result<OAuthUserInfo, String>>

Replace the base JSON decoder for a custom provider.

§map_profile_to_user: Option<Arc<dyn OAuthProfileMapper>>

Map local fields after built-in profile decoding without changing account identity.

§get_user_info: Option<Arc<dyn OAuthUserInfoHandler>>§refresh_access_token: Option<Arc<dyn OAuthRefreshTokenHandler>>§verify_id_token: Option<Arc<dyn OAuthIdTokenVerifier>>§disable_implicit_sign_up: Option<bool>§disable_sign_up: Option<bool>§require_email_verification: Option<bool>

Require the local user’s email to be verified before issuing a session.

§override_user_info_on_sign_in: bool

Implementations§

Source§

impl OAuthProvider

Source

pub fn apple( client_id: &str, client_secret: &str, options: AppleOptions, ) -> Self

Configure Apple authorization, token grants, and direct ID-token verification.

client_secret is a static Apple client secret. Pass an empty string when AppleOptions::client_secret_signer generates the secret. Direct ID-token sign-in needs neither.

Source§

impl OAuthProvider

Source

pub fn microsoft( client_id: &str, client_secret: &str, options: MicrosoftOptions, ) -> AuthResult<Self>

Configure Social Microsoft with its tenant, authority, photo, and assertion options.

Source

pub fn cognito( client_id: &str, client_secret: &str, options: CognitoOptions, ) -> AuthResult<Self>

Configure a Cognito hosted domain and its fixed user-pool issuer and JWKS. Set identity_provider through authorization_params to select a federated provider.

Source

pub fn custom( client_id: &str, client_secret: &str, auth_url: &str, token_url: &str, ) -> Self

Configure a custom social provider with explicit endpoints and profile handling.

Source

pub fn google(client_id: &str, client_secret: &str) -> Self

Configure Google with its built-in endpoints and profile decoder.

Source

pub fn google_with_options( client_id: &str, client_secret: &str, options: GoogleOptions, ) -> Self

Configure Google with additional ID-token audiences.

Source

pub fn github(client_id: &str, client_secret: &str) -> Self

Configure GitHub with its built-in profile and email lookup.

Source

pub fn github_with_endpoints( client_id: &str, client_secret: &str, auth_url: &str, token_url: &str, user_info_url: &str, user_emails_url: &str, ) -> Self

Configure GitHub with custom endpoints while retaining GitHub profile semantics.

Source

pub fn discord(client_id: &str, client_secret: &str) -> Self

Configure Discord with its built-in endpoints and profile decoder.

Source

pub fn gitlab(client_id: &str, client_secret: &str) -> Self

Configure GitLab with its built-in endpoints and active-user profile decoder.

Source

pub fn gitlab_with_issuer( client_id: &str, client_secret: &str, issuer: &str, ) -> Self

Configure GitLab endpoints from an issuer, preserving its path prefix. An empty issuer selects gitlab.com. Repeated path slashes are collapsed.

Source

pub fn spotify(client_id: &str, client_secret: &str) -> Self

Configure Spotify with its built-in endpoints and profile decoder.

Source

pub fn huggingface(client_id: &str, client_secret: &str) -> Self

Configure Hugging Face with its built-in endpoints and HTTP profile decoder.

Source

pub fn polar(client_id: &str, client_secret: &str) -> Self

Configure Polar with its built-in endpoints and HTTP profile decoder.

Source

pub fn vercel(client_id: &str, client_secret: &str) -> Self

Configure Vercel with its built-in endpoints and HTTP profile decoder.

Source

pub fn figma(client_id: &str, client_secret: &str) -> Self

Configure Figma with PKCE, HTTP Basic token authentication, and its HTTP profile decoder.

Source

pub fn dropbox(client_id: &str, client_secret: &str) -> Self

Configure Dropbox with PKCE, client-secret-post authentication, and its POST profile lookup.

Source

pub fn kick(client_id: &str, client_secret: &str) -> Self

Configure Kick with PKCE, client-secret-post, and its HTTP profile decoder.

Source

pub fn linkedin(client_id: &str, client_secret: &str) -> Self

Configure LinkedIn with its code flow, client-secret-post, and Bearer HTTP profile. LinkedIn omits PKCE parameters in the pinned provider protocol.

Source

pub fn slack(client_id: &str, client_secret: &str) -> Self

Configure Slack with its code flow, client-secret-post, and OpenID HTTP profile.

Source

pub fn naver(client_id: &str, client_secret: &str) -> Self

Configure Naver with its code flow, client-secret-post, and HTTP profile envelope.

Source

pub fn line(client_id: &str, client_secret: &str) -> Self

Configure Social LINE with PKCE and its remote direct ID-token verifier.

Source

pub fn linear(client_id: &str, client_secret: &str) -> Self

Configure Linear with its code flow, client-secret-post, and GraphQL viewer profile.

Source

pub fn atlassian(client_id: &str, client_secret: &str) -> Self

Configure Atlassian with PKCE, client-secret-post, and its HTTP account profile.

Source

pub fn salesforce(client_id: &str, client_secret: &str) -> Self

Configure Salesforce production with PKCE and its HTTP user-info profile. Set auth_url, token_url, and user_info_url together for a sandbox or custom login host.

Source

pub fn reddit(client_id: &str, client_secret: &str) -> Self

Configure Reddit with HTTP Basic token authentication and its API user profile. Set duration to permanent through authorization_params for persistent access.

Source

pub fn kakao(client_id: &str, client_secret: &str) -> Self

Configure Kakao with ordered scopes, client-secret-post, and its account profile.

Source

pub fn zoom(client_id: &str, client_secret: &str) -> Self

Configure Zoom with authorization PKCE, client-secret-post, and its HTTP user profile. The pinned Zoom provider ignores configured and request scopes.

Source

pub fn zoom_without_pkce(client_id: &str, client_secret: &str) -> Self

Configure Zoom with its pkce: false option for the authorization URL. Code exchange still forwards the supplied verifier, matching the pinned provider.

Source

pub fn twitter(client_id: &str, client_secret: &str) -> Self

Configure Twitter with PKCE, HTTP Basic token authentication, and its two user-info requests.

Source

pub fn wechat(client_id: &str, client_secret: &str) -> Self

Configure WeChat WebsiteApp with GET grants and its HTTP profile lookup. Set authorization_params’s lang to en for the English authorization page.

Source

pub fn wechat_with_endpoints( client_id: &str, client_secret: &str, auth_url: &str, token_url: &str, refresh_url: &str, user_info_url: &str, ) -> Self

Configure WeChat endpoints while retaining its GET grants and profile semantics.

Source

pub fn vk(client_id: &str, client_secret: &str) -> Self

Configure VK with PKCE, client-secret-post grants, and form-based user info.

Source

pub fn twitch( client_id: &str, client_secret: &str, options: TwitchOptions, ) -> Self

Configure Twitch with requested ID-token claims and client-secret-post grants.

Source

pub fn notion(client_id: &str, client_secret: &str) -> Self

Configure Notion with its user-owned integration and owner profile.

Source

pub fn roblox(client_id: &str, client_secret: &str) -> Self

Configure Roblox with its profile scopes, account prompt, and HTTP user profile.

Source

pub fn tiktok(client_key: &str, client_secret: &str) -> Self

Configure TikTok with a client key, comma-separated scopes, and its HTTP profile. TikTok sends the client key and secret in both token grants.

Source

pub fn railway(client_id: &str, client_secret: &str) -> Self

Configure Railway with PKCE, HTTP Basic token authentication, and its OpenID profile.

Source

pub fn cloudflare(client_id: &str, client_secret: &str) -> Self

Configure Cloudflare with PKCE and its API user profile. Pass an empty secret for a public client; confidential clients default to HTTP Basic.

Source§

impl OAuthProvider

Source

pub fn facebook( client_id: &str, client_secret: &str, options: FacebookOptions, ) -> Self

Configure Facebook Graph login and verified Limited Login profiles. Set config_id through authorization_params for Facebook Login for Business.

Source§

impl OAuthProvider

Source

pub fn paybin(client_id: &str, client_secret: &str) -> Self

Configure Paybin with its default issuer and verified ID-token profiles.

Source

pub fn paybin_with_issuer( client_id: &str, client_secret: &str, issuer: &str, ) -> Self

Configure a Paybin issuer while retaining the Social provider protocol. Custom issuers declare their JWKS through OpenID discovery.

Source§

impl OAuthProvider

Source

pub fn paypal(client_id: &str, client_secret: &str) -> Self

Configure PayPal sandbox code login with PKCE and HTTP Basic grants. Optional ID tokens require an explicit application verify_id_token callback.

Source

pub fn paypal_live(client_id: &str, client_secret: &str) -> Self

Configure PayPal live code login with the same explicit ID-token verification policy.

Source§

impl OAuthProvider

Source

pub fn disable_implicit_sign_up(&self) -> bool

Return the effective implicit sign-up policy.

Source

pub fn disable_sign_up(&self) -> bool

Return the effective sign-up policy.

Trait Implementations§

Source§

impl Clone for OAuthProvider

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. 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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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