GitHubProvider

class gafaelfawr.providers.github.GitHubProvider(*, config: GitHubConfig, http_session: ClientSession, issuer: TokenIssuer, session_store: SessionStore, logger: BoundLogger)

Bases: gafaelfawr.providers.base.Provider

Authenticate a user with GitHub.

Parameters:

Methods Summary

create_session(code, state) Given the code from a successful authentication, create a session.
get_redirect_url(state) Get the login URL to which to redirect the user.

Methods Documentation

create_session(code: str, state: str) → gafaelfawr.session.Session

Given the code from a successful authentication, create a session.

Parameters:
  • code (str) – Code returned by a successful authentication.
  • state (str) – The same random string used for the redirect URL.
Returns:

session – The new authentication session.

Return type:

gafaelfawr.session.Session

Raises:
get_redirect_url(state: str) → str

Get the login URL to which to redirect the user.

Parameters:state (str) – A random string used for CSRF protection.
Returns:url – The encoded URL to which to redirect the user.
Return type:str