{"id":4294,"library":"types-authlib","title":"Typing stubs for Authlib","description":"This is a type stub package for the Authlib library, providing static type checking for Authlib code. As part of the typeshed project, it's automatically released up to once a day. This version of types-Authlib aims to provide accurate annotations for Authlib==1.6.9. [9, 8, 23]","status":"active","version":"1.6.9.20260408","language":"en","source_language":"en","source_url":"https://github.com/python/typeshed","tags":["typing","stubs","type hints","authlib","authentication","authorization"],"install":[{"cmd":"pip install types-authlib","lang":"bash","label":"Install types-authlib"}],"dependencies":[{"reason":"Provides the runtime functionality that these stubs type-check. You must install Authlib separately.","package":"Authlib","optional":false}],"imports":[{"note":"Commonly used for Flask OAuth clients.","symbol":"OAuth","correct":"from authlib.integrations.flask_client import OAuth"},{"note":"Used for building OAuth 2.0 authorization servers with Flask.","symbol":"AuthorizationServer","correct":"from authlib.integrations.flask_oauth2 import AuthorizationServer"},{"note":"For JSON Web Token (JWT) operations.","symbol":"JsonWebToken","correct":"from authlib.jose import JsonWebToken"}],"quickstart":{"code":"import os\nfrom flask import Flask\nfrom authlib.integrations.flask_client import OAuth\n\n# NOTE: For actual use, configure these securely from environment variables\n# or a configuration management system, not hardcoded.\nCLIENT_ID = os.environ.get('GOOGLE_CLIENT_ID', 'your-google-client-id')\nCLIENT_SECRET = os.environ.get('GOOGLE_CLIENT_SECRET', 'your-google-client-secret')\n\napp = Flask(__name__)\napp.config.update({\n    'SECRET_KEY': 'very-secret-key-for-session',\n    'GOOGLE_CLIENT_ID': CLIENT_ID,\n    'GOOGLE_CLIENT_SECRET': CLIENT_SECRET\n})\n\noauth = OAuth(app)\n\noauth.register(\n    name='google',\n    client_id=app.config['GOOGLE_CLIENT_ID'],\n    client_secret=app.config['GOOGLE_CLIENT_SECRET'],\n    access_token_url='https://oauth2.googleapis.com/token',\n    authorize_url='https://accounts.google.com/o/oauth2/auth',\n    api_base_url='https://www.googleapis.com/oauth2/v1/',\n    client_kwargs={'scope': 'openid email profile'}\n)\n\nprint(\"Authlib OAuth client registered for Google. \")\nprint(\"This example demonstrates type-checked setup, but does not run a server.\")\nprint(\"Run a type checker like MyPy on this file after installing types-authlib.\")","lang":"python","description":"This quickstart demonstrates setting up an Authlib OAuth client using Flask integration. While it's a runtime example for Authlib, its purpose here is to show code that `types-authlib` would type-check. You must install `Authlib` (e.g., `pip install Authlib Flask`) and optionally `python-dotenv` for environment variables, in addition to `types-authlib`."},"warnings":[{"fix":"Ensure both `Authlib` and `types-authlib` are present in your project's dependencies.","message":"The `types-authlib` package provides only type stubs and does not install `Authlib` itself. For effective type checking and runtime functionality, you must install both `Authlib` (e.g., `pip install Authlib`) and `types-authlib`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Align the major and minor version of `types-authlib` with your `Authlib` installation (e.g., `pip install 'Authlib==1.6.*' 'types-Authlib==1.6.*'`).","message":"The `types-authlib` package is specifically versioned to target a particular `Authlib` runtime library release (e.g., `types-Authlib==1.6.9.x` provides stubs for `Authlib==1.6.9`). Mismatches between the installed `types-authlib` version and the `Authlib` version can lead to type checking errors or unannotated code.","severity":"breaking","affected_versions":"All versions"},{"fix":"Consider pinning the version of `types-authlib` in your `requirements.txt` or `pyproject.toml` to ensure consistent type checking results across environments.","message":"As `types-authlib` is part of the `typeshed` project, its stubs are automatically released and updated frequently. These updates can sometimes introduce minor changes that might cause new type checker warnings or errors, even if the underlying `Authlib` library has not changed. [8]","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your project is running on Python 3.10 or newer.","message":"`types-authlib` requires Python `>=3.10`. Using it with older Python versions will result in installation failures or compatibility issues. Note that `Authlib` itself dropped Python 2 support with version 1.0.0.","severity":"breaking","affected_versions":"<3.10"},{"fix":"Refer to the Authlib changelog for breaking changes (e.g., `docs.authlib.org/en/latest/history.html`) and update both `Authlib` and `types-Authlib` accordingly.","message":"Authlib itself has undergone significant API changes in major versions (e.g., 0.12, 0.14, 1.0, 1.1) related to grant systems, removal of built-in SQLAlchemy integration, and JOSE module renames. If you upgrade Authlib, ensure you also update `types-authlib` to a compatible version to avoid numerous type checking errors. [1, 2, 4, 5]","severity":"breaking","affected_versions":"Authlib < 1.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}