PHPackages                             rrd108/api-token-authenticator - 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. rrd108/api-token-authenticator

ActiveCakephp-plugin[Authentication &amp; Authorization](/categories/authentication)

rrd108/api-token-authenticator
==============================

A Simple Token Authentication Plugin for CakePHP 5 REST API-s

1.2.2(6mo ago)32.0k[4 issues](https://github.com/rrd108/api-token-authenticator/issues)MITPHPPHP &gt;=8.2CI failing

Since Jul 9Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/rrd108/api-token-authenticator)[ Packagist](https://packagist.org/packages/rrd108/api-token-authenticator)[ RSS](/packages/rrd108-api-token-authenticator/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (4)Versions (25)Used By (0)

CakePHP ApiTokenAuthenticator Plugin
====================================

[](#cakephp-apitokenauthenticator-plugin)

A Simple Token Authentication Plugin for CakePHP 5 REST API-s.

For CakePHP 4 version see [rrd108/api-token-authenticator](https://github.com/rrd108/api-token-authenticator/tree/cakephp-4)

For a REST API you may want to use a cors plugin like [rrd108/cakephp-cors](https://github.com/rrd108/cakephp-cors) and a json api exception plugin like [rrd108/cakephp-json-api-exception](https://github.com/rrd108/cakephp-json-api-exception).

If you use vuejs as your frontend you may wnat to bake your vue components with [rrd108/vue-bake](https://github.com/rrd108/vue-bake).

Configuration
-------------

[](#configuration)

### `Users` table

[](#users-table)

In your `users` table you should have a field named `token`, or whatever name you choose for the token. We will use `token` in the examples. The `token` value will not be automatically generated by the plugin. You can generate it in your `UsersController.php` file's `login()` method (or elsewhere if you want). See the example below.

### Changing the default settings

[](#changing-the-default-settings)

If you are happy with the default settings, you can skip this section.

For defaults see `config/apiTokenAuthenticator.php` file in the plugin's directory.

If you want to change any of the values then create your own `config/apiTokenAuthenticator.php` file at your project's `config` directory. In your config file, you should use *only* those keys that you want to change. It will be merged to the default one. So, for example, if you are happy with all the options, except in your case the token's header name is `Authorization`, then you have to put this into your on config file.

```
