CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-google-auth-oauthlib

Google Authentication Library - oauthlib integration for OAuth 2.0 flows.

83

1.05x
Overview
Eval results
Files

task.mdevals/scenario-4/

OAuth Session to Credentials Converter

A utility that converts OAuth 2.0 session objects into Google-compatible credential objects for use with Google APIs.

Capabilities

Convert OAuth Session to Credentials

  • Given an OAuth session with access token "test_access_token_123", refresh token "test_refresh_token_456", client ID "client_id_789", client secret "client_secret_xyz", and token URI "https://oauth2.googleapis.com/token", the converter returns a credentials object that can be used with Google APIs @test
  • Given an OAuth session with an ID token "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", the converter includes the ID token in the returned credentials @test
  • Given an OAuth session with token expiry set to a timestamp, the converter preserves the expiry information in the returned credentials @test

Handle Scopes

  • Given an OAuth session with requested scopes ["scope1", "scope2"] and granted scopes ["scope1"], the converter correctly sets both scope types in the credentials @test

Implementation

@generates

API

def convert_session_to_credentials(session, client_id, client_secret, token_uri):
    """
    Converts an OAuth 2.0 session into Google-compatible credentials.

    Args:
        session: An OAuth2Session object containing token information
        client_id: The OAuth client ID string
        client_secret: The OAuth client secret string
        token_uri: The token endpoint URI string

    Returns:
        A Google credentials object compatible with google-auth library
    """
    pass

Dependencies { .dependencies }

google-auth-oauthlib { .dependency }

Provides OAuth 2.0 integration with Google authentication library for converting sessions to credentials.

Install with Tessl CLI

npx tessl i tessl/pypi-google-auth-oauthlib

tile.json