From 84f2d5ece9a46ba56c5ac5ffb344cff012b20986 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Tue, 26 Jun 2018 22:09:46 +0300 Subject: [PATCH] small config changes. --- src/Security/ApiTokenAuthenticator.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Security/ApiTokenAuthenticator.php b/src/Security/ApiTokenAuthenticator.php index 7610bd4..99561f0 100644 --- a/src/Security/ApiTokenAuthenticator.php +++ b/src/Security/ApiTokenAuthenticator.php @@ -26,7 +26,9 @@ class ApiTokenAuthenticator implements SimplePreAuthenticatorInterface, Authenti public function createToken(Request $request, $providerKey) { if (!($tokenKey = $request->headers->get(self::TOKEN_HEADER))) { - throw new BadCredentialsException(sprintf('\'%s\' is invalid or not defined', self::TOKEN_HEADER)); + // Throwing exception here will break anonymous authentication for login method + //throw new BadCredentialsException(sprintf('\'%s\' is invalid or not defined', self::TOKEN_HEADER)); + return null; } return new PreAuthenticatedToken(