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