Skip to main content

rs_auth_core/oauth/providers/
github.rs

1use crate::oauth::OAuthProviderConfig;
2
3pub fn github_provider(
4    client_id: &str,
5    client_secret: &str,
6    redirect_url: &str,
7    auth_url: Option<&str>,
8    token_url: Option<&str>,
9    userinfo_url: Option<&str>,
10) -> OAuthProviderConfig {
11    OAuthProviderConfig {
12        provider_id: "github".to_string(),
13        client_id: client_id.to_string(),
14        client_secret: client_secret.to_string(),
15        auth_url: auth_url
16            .unwrap_or("https://github.com/login/oauth/authorize")
17            .to_string(),
18        token_url: token_url
19            .unwrap_or("https://github.com/login/oauth/access_token")
20            .to_string(),
21        userinfo_url: userinfo_url
22            .unwrap_or("https://api.github.com/user")
23            .to_string(),
24        scopes: vec!["user:email".to_string()],
25        redirect_url: redirect_url.to_string(),
26    }
27}