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: boolExclude the built-in provider scopes from authorization requests.
disable_id_token_sign_in: boolReject 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.
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: boolImplementations§
Source§impl OAuthProvider
impl OAuthProvider
Sourcepub fn apple(
client_id: &str,
client_secret: &str,
options: AppleOptions,
) -> Self
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
impl OAuthProvider
Sourcepub fn microsoft(
client_id: &str,
client_secret: &str,
options: MicrosoftOptions,
) -> AuthResult<Self>
pub fn microsoft( client_id: &str, client_secret: &str, options: MicrosoftOptions, ) -> AuthResult<Self>
Configure Social Microsoft with its tenant, authority, photo, and assertion options.
Sourcepub fn cognito(
client_id: &str,
client_secret: &str,
options: CognitoOptions,
) -> AuthResult<Self>
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.
Sourcepub fn custom(
client_id: &str,
client_secret: &str,
auth_url: &str,
token_url: &str,
) -> Self
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.
Sourcepub fn google(client_id: &str, client_secret: &str) -> Self
pub fn google(client_id: &str, client_secret: &str) -> Self
Configure Google with its built-in endpoints and profile decoder.
Sourcepub fn google_with_options(
client_id: &str,
client_secret: &str,
options: GoogleOptions,
) -> Self
pub fn google_with_options( client_id: &str, client_secret: &str, options: GoogleOptions, ) -> Self
Configure Google with additional ID-token audiences.
Sourcepub fn github(client_id: &str, client_secret: &str) -> Self
pub fn github(client_id: &str, client_secret: &str) -> Self
Configure GitHub with its built-in profile and email lookup.
Sourcepub 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
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.
Sourcepub fn discord(client_id: &str, client_secret: &str) -> Self
pub fn discord(client_id: &str, client_secret: &str) -> Self
Configure Discord with its built-in endpoints and profile decoder.
Sourcepub fn gitlab(client_id: &str, client_secret: &str) -> Self
pub fn gitlab(client_id: &str, client_secret: &str) -> Self
Configure GitLab with its built-in endpoints and active-user profile decoder.
Sourcepub fn gitlab_with_issuer(
client_id: &str,
client_secret: &str,
issuer: &str,
) -> Self
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.
Sourcepub fn spotify(client_id: &str, client_secret: &str) -> Self
pub fn spotify(client_id: &str, client_secret: &str) -> Self
Configure Spotify with its built-in endpoints and profile decoder.
Sourcepub fn huggingface(client_id: &str, client_secret: &str) -> Self
pub fn huggingface(client_id: &str, client_secret: &str) -> Self
Configure Hugging Face with its built-in endpoints and HTTP profile decoder.
Sourcepub fn polar(client_id: &str, client_secret: &str) -> Self
pub fn polar(client_id: &str, client_secret: &str) -> Self
Configure Polar with its built-in endpoints and HTTP profile decoder.
Sourcepub fn vercel(client_id: &str, client_secret: &str) -> Self
pub fn vercel(client_id: &str, client_secret: &str) -> Self
Configure Vercel with its built-in endpoints and HTTP profile decoder.
Sourcepub fn figma(client_id: &str, client_secret: &str) -> Self
pub fn figma(client_id: &str, client_secret: &str) -> Self
Configure Figma with PKCE, HTTP Basic token authentication, and its HTTP profile decoder.
Sourcepub fn dropbox(client_id: &str, client_secret: &str) -> Self
pub fn dropbox(client_id: &str, client_secret: &str) -> Self
Configure Dropbox with PKCE, client-secret-post authentication, and its POST profile lookup.
Sourcepub fn kick(client_id: &str, client_secret: &str) -> Self
pub fn kick(client_id: &str, client_secret: &str) -> Self
Configure Kick with PKCE, client-secret-post, and its HTTP profile decoder.
Sourcepub fn linkedin(client_id: &str, client_secret: &str) -> Self
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.
Sourcepub fn slack(client_id: &str, client_secret: &str) -> Self
pub fn slack(client_id: &str, client_secret: &str) -> Self
Configure Slack with its code flow, client-secret-post, and OpenID HTTP profile.
Configure Naver with its code flow, client-secret-post, and HTTP profile envelope.
Sourcepub fn line(client_id: &str, client_secret: &str) -> Self
pub fn line(client_id: &str, client_secret: &str) -> Self
Configure Social LINE with PKCE and its remote direct ID-token verifier.
Sourcepub fn linear(client_id: &str, client_secret: &str) -> Self
pub fn linear(client_id: &str, client_secret: &str) -> Self
Configure Linear with its code flow, client-secret-post, and GraphQL viewer profile.
Sourcepub fn atlassian(client_id: &str, client_secret: &str) -> Self
pub fn atlassian(client_id: &str, client_secret: &str) -> Self
Configure Atlassian with PKCE, client-secret-post, and its HTTP account profile.
Sourcepub fn salesforce(client_id: &str, client_secret: &str) -> Self
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.
Sourcepub fn reddit(client_id: &str, client_secret: &str) -> Self
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.
Sourcepub fn kakao(client_id: &str, client_secret: &str) -> Self
pub fn kakao(client_id: &str, client_secret: &str) -> Self
Configure Kakao with ordered scopes, client-secret-post, and its account profile.
Sourcepub fn zoom(client_id: &str, client_secret: &str) -> Self
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.
Sourcepub fn zoom_without_pkce(client_id: &str, client_secret: &str) -> Self
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.
Sourcepub fn twitter(client_id: &str, client_secret: &str) -> Self
pub fn twitter(client_id: &str, client_secret: &str) -> Self
Configure Twitter with PKCE, HTTP Basic token authentication, and its two user-info requests.
Sourcepub fn wechat(client_id: &str, client_secret: &str) -> Self
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.
Sourcepub fn wechat_with_endpoints(
client_id: &str,
client_secret: &str,
auth_url: &str,
token_url: &str,
refresh_url: &str,
user_info_url: &str,
) -> Self
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.
Sourcepub fn vk(client_id: &str, client_secret: &str) -> Self
pub fn vk(client_id: &str, client_secret: &str) -> Self
Configure VK with PKCE, client-secret-post grants, and form-based user info.
Sourcepub fn twitch(
client_id: &str,
client_secret: &str,
options: TwitchOptions,
) -> Self
pub fn twitch( client_id: &str, client_secret: &str, options: TwitchOptions, ) -> Self
Configure Twitch with requested ID-token claims and client-secret-post grants.
Sourcepub fn notion(client_id: &str, client_secret: &str) -> Self
pub fn notion(client_id: &str, client_secret: &str) -> Self
Configure Notion with its user-owned integration and owner profile.
Sourcepub fn roblox(client_id: &str, client_secret: &str) -> Self
pub fn roblox(client_id: &str, client_secret: &str) -> Self
Configure Roblox with its profile scopes, account prompt, and HTTP user profile.
Sourcepub fn tiktok(client_key: &str, client_secret: &str) -> Self
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.
Sourcepub fn railway(client_id: &str, client_secret: &str) -> Self
pub fn railway(client_id: &str, client_secret: &str) -> Self
Configure Railway with PKCE, HTTP Basic token authentication, and its OpenID profile.
Sourcepub fn cloudflare(client_id: &str, client_secret: &str) -> Self
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
impl OAuthProvider
Sourcepub fn facebook(
client_id: &str,
client_secret: &str,
options: FacebookOptions,
) -> Self
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
impl OAuthProvider
Sourcepub fn paybin(client_id: &str, client_secret: &str) -> Self
pub fn paybin(client_id: &str, client_secret: &str) -> Self
Configure Paybin with its default issuer and verified ID-token profiles.
Sourcepub fn paybin_with_issuer(
client_id: &str,
client_secret: &str,
issuer: &str,
) -> Self
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
impl OAuthProvider
Sourcepub fn paypal(client_id: &str, client_secret: &str) -> Self
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.
Sourcepub fn paypal_live(client_id: &str, client_secret: &str) -> Self
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
impl OAuthProvider
Sourcepub fn disable_implicit_sign_up(&self) -> bool
pub fn disable_implicit_sign_up(&self) -> bool
Return the effective implicit sign-up policy.
Sourcepub fn disable_sign_up(&self) -> bool
pub fn disable_sign_up(&self) -> bool
Return the effective sign-up policy.