Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Can't add header Authorization for jwt token #266

Description

@ehibes

Hi,

I'm trying to login to an API before execute some behat tests with this function. It seems not to accept the header.

/**
 * @BeforeScenario @login
 *
 */
public function login(BeforeScenarioScope $scope)
{
    $user = $this->doctrine->getManager()->getRepository('App:User')->findOneByEmail('test@test.com');

    $token = $this->jwtManager->create($user);

    $this->restContext = $scope->getEnvironment()->getContext(RestContext::class);
    $this->restContext->iAddHeaderEqualTo('Authorization', "Bearer $token");
    $this->restContext->printLastResponseHeaders();
}

The last line return following output, where authorization header is missing

content-type: application/ld+json; charset=utf-8
x-content-type-options: nosniff
x-frame-options: deny
cache-control: no-cache, private
date: Tue, 23 Oct 2018 15:58:14 GMT
link: <https://localhost/api/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions