rustauth_plugins/generic_oauth/providers/
gumroad.rs1use crate::generic_oauth::GenericOAuthConfig;
4use std::sync::Arc;
5
6pub const PROVIDER_ID: &str = "gumroad";
7
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct GumroadOptions {
10 pub base: super::BaseOAuthProviderOptions,
11}
12
13pub fn gumroad(options: GumroadOptions) -> GenericOAuthConfig {
14 let mut config = GenericOAuthConfig::new(
15 PROVIDER_ID,
16 "",
17 None::<String>,
18 "https://gumroad.com/oauth/authorize",
19 "https://api.gumroad.com/oauth/token",
20 );
21 config.user_info_url = Some("https://api.gumroad.com/v2/user".to_owned());
22 super::apply_base_options(&mut config, options.base, vec!["view_profile".to_owned()]);
23 config.get_user_info = Some(Arc::new(|tokens| {
24 Box::pin(super::user_info::gumroad(tokens))
25 }));
26 config
27}