Slim REST authorization returns empty

This is my function to get the headers.

 function authenticate(\Slim\Route $route ) {
    // Getting request headers
    $app = \Slim\Slim::getInstance();
    $headers = $app->request()->headers()->all();
    $response = array();

    die(var_export($headers));
  }

And what im getting on post man is

array (
    Authorization' => '',
      'Host' => 'localhost',
      'Connection' => 'keep-alive',
      'Content-Length' => '0',
      'Cache-Control' => 'no-cache',
      'Origin' => 'chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop',
      'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36     (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36',
      'Postman-Token' => 'bd5e445c-bba1-b7fc-29e6-17724a83dcbd',
      'Accept' => '*/*',
      'Accept-Encoding' => 'gzip, deflate',
      'Accept-Language' => 'en-US,en;q=0.8',
    )

Upvotes: 0

Views: 532

Answers (1)

AkshayP
AkshayP

Reputation: 2169

You can choose to save helper data to collection requests. This will cause the signature to be regenerated each time. These helpers will even work in Newman!

enter image description here

Enter the username and password fields and hit "Refresh headers" to generate the authorization header.

Please visit POSTMAN Helpers

Update

For more help visit here

Upvotes: 1

Related Questions