Python SDK for Authdog authentication and user management.
pip install authdogfromauthdogimportAuthdogClient# Initialize the clientclient=AuthdogClient(
base_url="https://api.authdog.com",
api_key="your-api-key"# Optional
)
# Get user informationtry:
user_info=client.get_userinfo("your-access-token")
print(f"User: {user_info['user']['displayName']}")
print(f"Email: {user_info['user']['emails'][0]['value']}")
exceptAuthenticationErrorase:
print(f"Authentication failed: {e}")
exceptAPIErrorase:
print(f"API error: {e}")
# Always close the client when doneclient.close()fromauthdogimportAuthdogClientwithAuthdogClient("https://api.authdog.com") asclient:
user_info=client.get_userinfo("your-access-token")
print(f"User: {user_info['user']['displayName']}")Initialize the Authdog client.
base_url: The base URL of the Authdog APIapi_key: Optional API key for authentication
Get user information using an access token.
access_token: The access token for authentication- Returns: Dict containing user information with the following structure:
{ "meta": { "code": 200, "message": "Success" }, "session": { "remainingSeconds": 56229 }, "user": { "id": "user-id", "externalId": "external-id", "userName": "username", "displayName": "Display Name", "emails": [{"value": "email@example.com", "type": null}], "photos": [{"value": "https://example.com/photo.jpg", "type": "photo"}], "names": { "familyName": "Last", "givenName": "First" }, "verifications": [...], "provider": "google-oauth20", "environmentId": "env-id" } }
AuthdogError: Base exception for all Authdog SDK errorsAuthenticationError: Raised when authentication fails (401 responses)APIError: Raised when API requests fail
# Install development dependencies
pip install -e ".[dev]"# Run tests
pytest
# Format code
black authdog/
isort authdog/
# Type checking
mypy authdog/