Something went wrong. Try again.
A lexicon-driven AppView for ATProto.
Something went wrong. Try again.
Rust
123456789101112131415161718192021use atrium_api::types::string::Did;
use crate::AppState;use crate::HappyViewOAuthSession;use crate::error::AppError;
/// Resume an OAuth session for the given DID via atrium./// The returned `OAuthSession` handles DPoP and token refresh internally.pub(crate) async fn get_oauth_session( state: &AppState, did: &str,) -> Result<HappyViewOAuthSession, AppError> { let did = Did::new(did.to_string()).map_err(|_| AppError::Auth(format!("invalid DID: {did}")))?; state .oauth .restore(&did) .await .map_err(|e| AppError::Auth(format!("no OAuth session for {}: {e}", did.as_ref())))}