mod grant;
pub(crate) mod token_response;
pub(crate) mod form;
pub use grant::{OAuth2ExchangeGrant, OAuth2ExchangeGrantError};
pub use token_response::TokenResponse;
pub(crate) fn mk_scopes(scopes: impl IntoIterator<Item = impl Into<String>>) -> Option<String> {
let maybe_scopes = scopes
.into_iter()
.filter_map(|s| {
let s = s.into();
(!s.trim().is_empty()).then_some(s)
})
.collect::<Vec<_>>();
(!maybe_scopes.is_empty()).then(|| maybe_scopes.join(" "))
}
pub type ExchangeError<C, Grant> = OAuth2ExchangeGrantError<
<C as crate::core::http::HttpClient>::Error,
<C as crate::core::http::HttpClient>::ResponseError,
<<Grant as OAuth2ExchangeGrant>::ClientAuth as crate::core::client_auth::ClientAuthentication>::Error,
<<Grant as OAuth2ExchangeGrant>::DPoP as crate::core::dpop::AuthorizationServerDPoP>::Error,
>;