tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.24k stars 1.55k forks source link

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

Open beshoo opened 1 year ago

beshoo commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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