Metadata-Version: 2.4
Name: pygeai-gam
Version: 0.1.0b2
Summary: GeneXus Access Manager (GAM) client for OAuth authentication
Author-email: Globant <geai-sdk@globant.com>
License: MIT
Project-URL: Homepage, https://github.com/globant/pygeai-gam
Project-URL: Documentation, https://docs.globant.ai
Project-URL: Repository, https://github.com/globant/pygeai-gam
Project-URL: Changelog, https://github.com/globant/pygeai-gam/blob/main/CHANGELOG.md
Keywords: geai,gam,oauth,authentication,genexus
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Requires-Dist: pydantic>=2.11.3
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: coverage>=7.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Dynamic: license-file

# pygeai-gam - GeneXus Access Manager Client

Standalone OAuth client for GeneXus Access Manager (GAM) with support for multiple grant types including PKCE.

> [!WARNING]
> This project is in Alpha stage and it's NOT suitable for production yet.
> While you can install the package and try it out, it's recommended to avoid using it in production until version 1.0.0
> is released

## Features

- **Multiple OAuth Grant Types:**
  - Password Grant (Resource Owner Password Credentials)
  - Authorization Code Grant
  - Authorization Code with PKCE (Proof Key for Code Exchange)
  
- **Secure OAuth Flow:**
  - Built-in callback server for authorization code flow
  - PKCE support for enhanced security
  - Token management and refresh
  
- **CLI Support:**
  - Interactive token acquisition
  - Configuration management
  - Multiple authentication workflows

## Installation

```bash
pip install pygeai-gam
```

## Quick Start

### Password Grant Flow

```python
from pygeai_gam import GAMClient

client = GAMClient(
    base_url="https://your-gam-server.com",
    client_id="your_client_id",
    client_secret="your_client_secret"
)

token = client.get_access_token_password_grant(
    username="user@example.com",
    password="your_password"
)

print(f"Access Token: {token['access_token']}")
```

### Authorization Code Flow with PKCE

```python
from pygeai_gam import GAMClient

client = GAMClient(
    base_url="https://your-gam-server.com",
    client_id="your_client_id",
    use_pkce=True
)

token = client.get_access_token_authorization_code(
    redirect_uri="http://localhost:8080/callback",
    scope="openid profile email"
)

print(f"Access Token: {token['access_token']}")
```

## Migration from pygeai.gam

If you were using GAM from the `pygeai` package, update your imports:

```python
# Before
from pygeai.gam.clients import GAMClient
from pygeai.gam.endpoints import GAM_ENDPOINTS

# After
from pygeai_gam import GAMClient
from pygeai_gam.endpoints import GAM_ENDPOINTS
```

Update your dependencies:

```bash
# Before
pip install pygeai

# After
pip install pygeai-gam
```

### Automated Migration

Use the migration script to update your codebase:

```bash
# Install pygeai with migration tools
pip install pygeai>=0.7.0

# Run migration script
migrate-pygeai-gam /path/to/your/project

# Preview changes without modifying files
migrate-pygeai-gam /path/to/your/project --dry-run
```

## CLI Usage

```bash
# Get access token using password grant
gam-cli token password \
  --base-url https://your-gam-server.com \
  --client-id your_client_id \
  --client-secret your_client_secret \
  --username user@example.com \
  --password your_password

# Get access token using authorization code with PKCE
gam-cli token auth-code \
  --base-url https://your-gam-server.com \
  --client-id your_client_id \
  --redirect-uri http://localhost:8080/callback \
  --use-pkce
```

## Documentation

Full documentation is available in the `docs/` directory.

## Development

```bash
# Navigate to package directory
cd pygeai-gam

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linter
ruff check .

# Format code
black .
```

## Requirements

- Python >= 3.10
- requests >= 2.31.0
- pydantic >= 2.11.3

## License

MIT License - See LICENSE file for details

## Bugs and Suggestions

To report any bug, request features or make any suggestions, the following email is available:

<geai-sdk@globant.com>

## Terms and Conditions

By using this package, you agree to the [Globant Enterprise AI Terms of Use](https://www.globant.com/enterprise-ai/terms-of-use).

## Authors

Copyright 2025, Globant. All rights reserved
