Skip to main content

rs_auth_core/oauth/
mod.rs

1pub mod client;
2pub mod github;
3pub mod google;
4pub mod providers;
5
6use serde::{Deserialize, Serialize};
7
8/// Information about a user obtained from an OAuth provider.
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct OAuthUserInfo {
11    pub provider_id: String,
12    pub account_id: String,
13    pub email: String,
14    pub name: Option<String>,
15    pub image: Option<String>,
16}
17
18/// Configuration for an OAuth provider.
19#[derive(Debug, Clone)]
20pub struct OAuthProviderConfig {
21    pub provider_id: String,
22    pub client_id: String,
23    pub client_secret: String,
24    pub auth_url: String,
25    pub token_url: String,
26    pub userinfo_url: String,
27    pub scopes: Vec<String>,
28    pub redirect_url: String,
29}
30
31/// OAuth tokens returned from provider.
32#[derive(Debug, Clone, Default)]
33pub struct OAuthTokens {
34    pub access_token: Option<String>,
35    pub refresh_token: Option<String>,
36    pub expires_in: Option<time::Duration>,
37    pub scope: Option<String>,
38}