Replies: 3 comments 2 replies
-
Make sure you set the namespace correctly. A correct example is as follows. <?php
// app/Config/AuthToken
declare(strict_types=1);
namespace Config;
use CodeIgniter\Shield\Config\AuthToken as ShieldAuthToken;
/**
* Configuration for Token Auth and HMAC Auth
*/
class AuthToken extends ShieldAuthToken
{
/**
* --------------------------------------------------------------------
* Name of Authenticator Header
* --------------------------------------------------------------------
* The name of Header that the Authorization token should be found.
* According to the specs, this should be `Authorization`, but rare
* circumstances might need a different header.
*/
public array $authenticatorHeader = [
'tokens' => 'Authorization',
'hmac' => 'Authorization',
];
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
I'm a little confused with that code in vendor/codeigniter4/shield/src/Filters/TokenAuth.php $authenticator = auth('tokens')->getAuthenticator();
$result = $authenticator->attempt([
'token' => $request->getHeaderLine(setting('Auth.authenticatorHeader')['tokens'] ?? 'Authorization'),
]);` I'm not sure how setting() works, but if I change 'Auth.authenticatorHeader' to 'AuthToken.authenticatorHeader' - everything works |
Beta Was this translation helpful? Give feedback.
1 reply
-
Bug fixed by #1169 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Have a feelling that I missed something, I copied this file (AuthToken.php) from vendor folder to app/Config but codeigniter ignores it.
I tried to change the $authenticatorHeader but it has no effect. If I decare this variable at Auth.php - everything works.
What I did wrong?
Beta Was this translation helpful? Give feedback.
All reactions