Parth Parmar
Parth Parmar

Reputation: 131

Laravel 5.5.45 Unauthenticated with passport

Its been more than 3 hours i'm searching for solution.

I have followed https://laravel.com/docs/5.5 docs to install laravel via composer and followed https://laravel.com/docs/5.5/passport guide for passport to install and configure.

I can generate OAuth tokens fine with postman but no matter what i do it always shows Unauthenticated.

Also i had to run commands below to install passport, because it had issue as well in installation as well.

composer require paragonie/random_compat:2.*
composer require laravel/passport=~4.0

I tried with multiple installs of laravel and this time i have not modified any laravel code, before i had tried to add days to token expiration which didn't work.

Also have tried these for apache.

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

These are the screenshots of postman enter image description here

enter image description here

I'm not sure which code i should share since all i did was just followed official documentation for laravel and passport from laravel site.

Upvotes: 0

Views: 277

Answers (2)

Parth Parmar
Parth Parmar

Reputation: 131

I had tried multiple times, There were two issues for me, when i tried first there was no .htaccess file for apache , so even after following all steps on laravel site it always showed me Unauthenticated,

And when i posted the question here i did forget to run php artisan passport:install command, So all i did was run the command as @ThatCoderGuy said and put .htaccess and its working now.

Upvotes: 0

ThatCoderGuy
ThatCoderGuy

Reputation: 677

have you ran php artisan passport:install ?

Upvotes: 2

Related Questions