Ctrl + K
DocumentationLog inGet started

tessl/pypi-google-auth-oauthlib

tessl install tessl/pypi-google-auth-oauthlib@1.2.0

Google Authentication Library - oauthlib integration for OAuth 2.0 flows.

Agent Success

Agent success rate when using this tile

83%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.05x

Baseline

Agent success rate without this tile

79%

task.mdevals/scenario-10/

OAuth 2.0 Token Manager

Build a simple token manager that handles OAuth 2.0 authorization flows for Google APIs.

Requirements

Your implementation should:

  1. Create an OAuth 2.0 flow from a client secrets configuration
  2. Generate an authorization URL for user consent
  3. Exchange an authorization code for access tokens
  4. Convert the OAuth session into Google credentials

The manager should work with the installed application flow pattern.

Test Cases

The implementation must pass the following test cases:

  • Creating a flow from a client configuration dictionary with auth_uri, token_uri, and client_id returns a valid Flow object @test
  • Generating an authorization URL from a valid flow returns a URL string and a state parameter @test
  • Exchanging a valid authorization response URL for tokens returns credentials with an access_token attribute @test

Implementation

@generates

API

def create_flow(client_config: dict, scopes: list[str], redirect_uri: str = "urn:ietf:wg:oauth:2.0:oob"):
    """
    Create an OAuth 2.0 flow from client configuration.

    Args:
        client_config: Dictionary with OAuth client settings
        scopes: List of OAuth 2.0 scopes to request
        redirect_uri: The redirect URI for the flow

    Returns:
        An OAuth flow object
    """
    pass

def get_authorization_url(flow):
    """
    Generate an authorization URL from a flow.

    Args:
        flow: An OAuth flow object

    Returns:
        Tuple of (authorization_url, state)
    """
    pass

def exchange_code_for_token(flow, authorization_response: str):
    """
    Exchange authorization code for access tokens.

    Args:
        flow: An OAuth flow object
        authorization_response: The authorization response URL

    Returns:
        Google credentials object with access token
    """
    pass

Dependencies { .dependencies }

google-auth-oauthlib { .dependency }

Provides OAuth 2.0 integration with Google's authentication library.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/google-auth-oauthlib@1.2.x
tile.json