Reputation: 35
I have 2 servers , an laravel API and an Auth server with passport. The authentication server generates the access token normally , i'm using client credentials.
When i try to protect my routes in API using the middleware auth:api
or client
, where it is defined on Kernel.php
it returns me 401 Unauthenticated
the API dont read the token correctly.
My route in the API
Route::middleware('client')->group(function () {
Route::resource('invoice' , 'InvoiceController')->middleware('scopes:x');
});
It returns 401, and the same route in Auth server works perfectly.
Upvotes: 1
Views: 1059
Reputation: 2187
Tokens are signed... with the Oauth keys... Use the same in both servers and that's all you need I think...
On one server you need keys... so
php artisan passport:keys
That generates the keys in the storage directory by default:
Then just copy those keys to the other server... the signature/encrpytion will then be the same in both servers...
Upvotes: 1