{"id":21630,"library":"oauth2-client","title":"OAuth2 Client","description":"A client library for OAuth2. Version 1.4.2, released irregularly. Provides OAuth2 authentication flows for Python applications.","status":"active","version":"1.4.2","language":"python","source_language":"en","source_url":"http://github.com/antechrestos/OAuth2Client","tags":["oauth2","authentication","client"],"install":[{"cmd":"pip install oauth2-client","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"HTTP client used internally for token exchange","package":"requests","optional":false}],"imports":[{"note":"The package is 'oauth2-client' but the import module is 'oauth2client' (no hyphen).","symbol":"OAuth2Client","correct":"from oauth2client.client import OAuth2Client"},{"note":"Flow is a subclass of OAuth2Client, not a top-level export.","wrong":"from oauth2client import Flow","symbol":"Flow","correct":"from oauth2client.client import Flow"}],"quickstart":{"code":"from oauth2client.client import OAuth2Client\nimport os\n\nclient_id = os.environ.get('OAUTH2_CLIENT_ID', '')\nclient_secret = os.environ.get('OAUTH2_CLIENT_SECRET', '')\nredirect_uri = 'http://localhost:8000/callback'\n\nclient = OAuth2Client(\n    client_id=client_id,\n    client_secret=client_secret,\n    redirect_uris=[redirect_uri],\n    auth_uri='https://provider.com/auth',\n    token_uri='https://provider.com/token',\n    scope=['email', 'profile']\n)\nprint('Client created:', client.client_id)","lang":"python","description":"Create an OAuth2 client with environment variables for credentials."},"warnings":[{"fix":"Use 'from oauth2client.client import OAuth2Client'.","message":"Package name 'oauth2-client' imports as 'oauth2client' (no hyphen). Many users try 'import oauth2_client' which fails.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using 'requests-oauthlib' or 'google-auth-oauthlib' for better maintained OAuth2 client.","message":"The 'oauth2-client' library is often confused with google-auth-oauthlib. This library is not maintained by Google and may lack modern features.","severity":"deprecated","affected_versions":"1.x"},{"fix":"Ensure provider returns an 'access_token' field in the JSON response.","message":"In version 1.3.0, the token endpoint response handling changed: the 'access_token' key is now required. Missing keys raise KeyError.","severity":"breaking","affected_versions":">=1.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"from oauth2client.client import OAuth2Client","cause":"Trying to import 'oauth2_client' (with underscore) instead of 'oauth2client' (no underscore).","error":"ImportError: No module named oauth2_client"},{"fix":"Use 'from oauth2client.client import OAuth2Client'.","cause":"Trying to import from the top-level package instead of the 'client' submodule.","error":"AttributeError: module 'oauth2client' has no attribute 'OAuth2Client'"},{"fix":"Check provider's token endpoint response and ensure it contains 'access_token'.","cause":"OAuth2 provider response missing the required 'access_token' field.","error":"KeyError: 'access_token'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}