rustauth_plugins/generic_oauth/providers/
auth0.rs1use crate::generic_oauth::GenericOAuthConfig;
4
5pub const PROVIDER_ID: &str = "auth0";
6
7#[derive(Debug, Clone, PartialEq, Eq)]
8pub struct Auth0Options {
9 pub base: super::BaseOAuthProviderOptions,
10 pub domain: String,
11}
12
13pub fn auth0(options: Auth0Options) -> GenericOAuthConfig {
14 let domain = options
15 .domain
16 .trim_start_matches("https://")
17 .trim_start_matches("http://")
18 .trim_end_matches('/');
19 let mut config = GenericOAuthConfig::discovery(
20 PROVIDER_ID,
21 "",
22 None::<String>,
23 format!("https://{domain}/.well-known/openid-configuration"),
24 );
25 super::apply_base_options(&mut config, options.base, openid_scopes());
26 config
27}
28
29fn openid_scopes() -> Vec<String> {
30 vec![
31 "openid".to_owned(),
32 "profile".to_owned(),
33 "email".to_owned(),
34 ]
35}