jwt-auth icon indicating copy to clipboard operation
jwt-auth copied to clipboard

Jwt-auth dos not recognized token via bearer header but can via GET

Open beshoo opened this issue 3 years ago • 2 comments
trafficstars

Subject of the issue

Describe your issue here.

Your environment

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 9.x.y
Package version current
PHP version 8

Steps to reproduce

Tell us how to reproduce this issue.

Expected behaviour

Recognized token via bearer header as well as GET

Actual behavior

When am using PostMan, I can not authenticate my request via bearer. only via GET, http://example.dev/me?token=eyJhbGciOiJIUzI1NiI...

beshoo avatar Sep 01 '22 19:09 beshoo

it seems Laravel can not see any header here

\vendor\laravel\framework\src\Illuminate\Http\Concerns\InteractsWithInput.php

public function bearerToken()
 {
     $header = $this->header('Authorization', '');

     $position = strrpos($header, 'Bearer ');

     if ($position !== false) {
         $header = substr($header, $position + 7);

         return str_contains($header, ',') ? strstr($header, ',', true) : $header;
     }
 }

beshoo avatar Sep 01 '22 21:09 beshoo

same as this https://github.com/tymondesigns/jwt-auth/issues/1026 but i don't understand how to fix the project to BE AUTOMATED

beshoo avatar Sep 01 '22 23:09 beshoo