PHPackages                             cpsit/api-token - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. cpsit/api-token

ActiveTypo3-cms-extension[Authentication &amp; Authorization](/categories/authentication)

cpsit/api-token
===============

Generate and validate token auth for api requests.

1.0.1(5mo ago)09.9k↓50%1GPL-2.0-or-laterPHPPHP ^8.3

Since Jan 10Pushed 5mo ago12 watchersCompare

[ Source](https://github.com/CPS-IT/api-token)[ Packagist](https://packagist.org/packages/cpsit/api-token)[ Docs](https://github.com/CPS-IT/api-token)[ RSS](/packages/cpsit-api-token/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (16)Versions (14)Used By (1)

API Token Extension for TYPO3
=============================

[](#api-token-extension-for-typo3)

[![TYPO3 12](https://camo.githubusercontent.com/ebabe0a8105378f3f366ee2235e4dcd50a97659b62c3f6c7e7436f832f12a852/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31322e342d6f72616e67652e737667)](https://get.typo3.org/version/12)[![TYPO3 13](https://camo.githubusercontent.com/1041e71047813f6b009ffc8e91d5af67e8fe8acafe5c4bda8723368bf0448cd6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31332e302d6f72616e67652e737667)](https://get.typo3.org/version/13)[![PHP 8.3+](https://camo.githubusercontent.com/83d697baa78e4225d630587096ed1b0d8a0ece94e9b2ebab599fc9bb986477ac/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332b2d626c75652e737667)](https://www.php.net/)[![License: GPL v2+](https://camo.githubusercontent.com/4c3bbb2162df305f1122d9aecffe3ac70c0464a1a77ba5b35bb83269084815a4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c25323076322b2d626c75652e737667)](https://www.gnu.org/licenses/gpl-2.0)

Secure API authentication for TYPO3 CMS applications using token-based authentication.

Features
--------

[](#features)

- 🔐 **Secure Token Generation** - Cryptographically secure random tokens
- 🛠 **Easy Integration** - Simple PHP API for authentication checks
- 📊 **Backend Management** - TYPO3 backend module for token administration
- ⚡ **CLI Support** - Command-line interface for automation
- 🧪 **Modern Testing** - Comprehensive test suite with PHPUnit 11
- 🚀 **TYPO3 v12/v13 Compatible** - Full support for latest TYPO3 versions

Quick Start
-----------

[](#quick-start)

### 1. Installation

[](#1-installation)

```
composer require cpsit/api-token
```

### 2. Generate a Token

[](#2-generate-a-token)

```
./vendor/bin/typo3 apitoken:generate
```

### 3. Protect Your API

[](#3-protect-your-api)

```
use CPSIT\ApiToken\Request\Validation\ApiTokenAuthenticator;

if (ApiTokenAuthenticator::isNotAuthenticated($request)) {
    return ApiTokenAuthenticator::returnErrorResponse();
}

// Your protected API logic here
```

### 4. Make API Requests

[](#4-make-api-requests)

```
curl -X POST "https://your-site.com/api/endpoint" \
     -H "x-api-identifier: your-identifier" \
     -H "application-authorization: your-secret" \
     -H "Content-Type: application/json"
```

Documentation
-------------

[](#documentation)

📚 **[Complete Documentation](Documentation/Index.md)**

TopicDescription[Introduction](Documentation/Introduction.md)Overview and key features[Installation](Documentation/Installation.md)Setup and configuration[Usage Guide](Documentation/Usage.md)How to use the extension[CLI Commands](Documentation/CliCommands.md)Command-line interface[Backend Module](Documentation/BackendModule.md)Admin interface guide[API Reference](Documentation/ApiReference.md)Complete API documentation[Development](Documentation/Development.md)Development environment setup[Testing](Documentation/Testing.md)Testing guide and best practices[Migration Guide](Documentation/Migration.md)Upgrade and migration notes[Troubleshooting](Documentation/Troubleshooting.md)Common issues and solutionsRequirements
------------

[](#requirements)

- **TYPO3**: 12.4 LTS or 13.0+
- **PHP**: 8.3 or higher
- **Database**: MySQL 8.0+, MariaDB 10.5+, or PostgreSQL 12+

Example Usage
-------------

[](#example-usage)

### Protecting an API Endpoint

[](#protecting-an-api-endpoint)

```
