authorize

Function authorize 

Source
pub async fn authorize(
    config: &OAuthConfig,
    cancel: Receiver<bool>,
    clock: &dyn Clock,
) -> Result<OAuthTokens, OAuthError>
Expand description

Open the user’s browser, wait for the OAuth callback, and exchange the authorization code for tokens.

Flow:

  1. Generate PKCE verifier + challenge
  2. Open browser to auth_url with the required parameters
  3. Spawn a one-shot HTTP server on localhost:{redirect_port}
  4. Wait for the callback with the authorization code
  5. Exchange the code for tokens at token_url