Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.pysquirrels.com/llms.txt

Use this file to discover all available pages before exploring further.

Configuration class for setting up OAuth authentication providers. This class can be imported from the squirrels.auth or the squirrels module.

Constructor

Creates a ProviderConfigs object.
def __init__(
    self, *, client_id: str, client_secret: str, server_url: str, 
    server_metadata_path: str = "/.well-known/oauth-authorization-server",
    client_kwargs: dict = {}, 
    get_user: Callable[[dict], RegisteredUser]
) -> None:

Example

from squirrels import auth, arguments as args

@auth.provider(
  name="google", label="Google", 
  icon="https://www.google.com/favicon.ico"
)
def google_auth_provider(sqrl: args.AuthProviderArgs) -> auth.ProviderConfigs:
    def get_user(user_info: dict) -> auth.RegisteredUser:
        # Convert OAuth user info to RegisteredUser
        pass
    
    provider_configs = auth.ProviderConfigs(
        client_id=sqrl.env_vars["GOOGLE_CLIENT_ID"],
        client_secret=sqrl.env_vars["GOOGLE_CLIENT_SECRET"],
        server_url="https://accounts.google.com",
        client_kwargs={"scope": "openid email profile"},
        get_user=get_sqrl_user
    )

    return provider_configs