1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum OAuthError {
5 #[error("User cancelled authorization")]
6 UserCancelled,
7
8 #[error("OAuth credential storage error: {0}")]
9 CredentialStore(String),
10
11 #[error("OS keychain error: {0}")]
12 Keychain(#[from] keyring::Error),
13
14 #[error("rmcp auth error: {0}")]
15 Rmcp(String),
16
17 #[error("IO error: {0}")]
18 Io(#[from] std::io::Error),
19
20 #[error("Invalid OAuth callback: {0}")]
21 InvalidCallback(String),
22
23 #[error("Invalid JWT: {0}")]
24 InvalidJwt(String),
25
26 #[error("Token exchange failed: {0}")]
27 TokenExchange(String),
28
29 #[error("OAuth state mismatch — possible CSRF attack")]
30 StateMismatch,
31
32 #[error("No credentials found: {0}")]
33 NoCredentials(String),
34}