pub struct GitHub { /* private fields */ }Expand description
OAuth 2.0 provider implementation for GitHub.
Implements the Authorization Code flow with PKCE (S256). Default scopes are
user:email and read:user. Override them via
OAuthProviderConfig::scopes.
The primary verified email is fetched from the GitHub /user/emails endpoint and used to
populate UserProfile::email and
UserProfile::email_verified.
Implementations§
Source§impl GitHub
impl GitHub
Sourcepub fn new(
config: &OAuthProviderConfig,
cookie_config: &CookieConfig,
key: &Key,
http_client: Client,
) -> Self
pub fn new( config: &OAuthProviderConfig, cookie_config: &CookieConfig, key: &Key, http_client: Client, ) -> Self
Creates a new GitHub provider from the given configuration.
cookie_config and key are used to sign the _oauth_state cookie that carries the
PKCE verifier and state nonce across the redirect. http_client is a
reqwest::Client used for the token exchange and user-info API calls.
Trait Implementations§
Source§impl OAuthProvider for GitHub
impl OAuthProvider for GitHub
Source§fn name(&self) -> &str
fn name(&self) -> &str
A stable, lowercase identifier for this provider (e.g.
"google", "github").Builds an authorization redirect response. Read more
Source§async fn exchange(
&self,
params: &CallbackParams,
state: &OAuthState,
) -> Result<UserProfile>
async fn exchange( &self, params: &CallbackParams, state: &OAuthState, ) -> Result<UserProfile>
Exchanges an authorization code for a
UserProfile. Read moreAuto Trait Implementations§
impl Freeze for GitHub
impl !RefUnwindSafe for GitHub
impl Send for GitHub
impl Sync for GitHub
impl Unpin for GitHub
impl UnsafeUnpin for GitHub
impl !UnwindSafe for GitHub
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more