I'm trying to log in to drupal8 via api rest using postman.
POST: https://example.com/user/login?_format=json
Content-type: application/json
{
"name": "admin",
"pass": "password"
}
The problem is that this error is returned to me.
An unexpected error has occurred. Please try again later, thanks.
Symfony\Component\Serializer\Exception\NotEncodableValueException: Syntax error in Symfony\Component\Serializer\Encoder\JsonDecode->decode() (line 78 of C:\www\drupal-composer\vendor\symfony\serializer\Encoder\JsonDecode.php).Symfony\Component\Serializer\Encoder\JsonEncoder->decode('', 'json', Array) (Line: 40)
Symfony\Component\Serializer\Encoder\ChainDecoder->decode('', 'json', Array) (Line: 280)
Symfony\Component\Serializer\Serializer->decode('', 'json') (Line: 167)
Drupal\user\Controller\UserAuthenticationController->login(Object) call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Does anyone have a solution? I am using Drupal 8.7.1.
NotEncodableValueException
. See comment #4 in what you linked to.