laravel-passport

Laravel 5.3 : Passport Implementation - {“error”:“invalid_client”,“message”:“Client authentication failed”}

匆匆过客 提交于 2019-12-10 13:43:00
问题 I followed the exact steps mentioned in the Laracast : What's New in Laravel 5.3: Laravel Passport to implement api authentication using oauth2 . My web.php file in the client/consumer project looks like: use Illuminate\Http\Request; Route::get('/', function () { $query = http_build_query([ 'client_id' => 2, 'redirect_uri' => 'http://offline.xyz.com/callback', 'response_type' => 'code', 'scope' => '', ]); return redirect ('http://api.xyz.com/oauth/authorize?'.$query); }); Route::get('

Laravel Passport Route [login] not defined

こ雲淡風輕ζ 提交于 2019-12-10 13:09:31
问题 i use Laravel passport for auth in route api.php Route::get('/todos', function(){ return 'hello'; })->middleware('auth:api'); but when open localhost:8000/api/todos I see the following error InvalidArgumentException Route [login] not defined. * @return string * * @throws \InvalidArgumentException */ public function route($name, $parameters = [], $absolute = true) { if (! is_null($route = $this->routes->getByName($name))) { return $this->toRoute($route, $parameters, $absolute); } throw new

Laravel Passport tokensExpireIn seems not working

血红的双手。 提交于 2019-12-10 03:05:52
问题 i'm using Larave 5.4 passport to create SPA application. However, i was able to make authentication work. but access token are always short-lived tokens with 600s expiration time. i could not increase expiration time with: Passport::tokensExpireIn(Carbon::now()->addDays(15)); Passport::refreshTokensExpireIn(Carbon::now()->addDays(30)); it have no effect at all. any help? thanks in advance. 回答1: Personal access tokens are always long-lived . Their lifetime is not modified when using the

Laravel Passport 404

左心房为你撑大大i 提交于 2019-12-09 18:58:43
问题 I installed Laravel Passport using the Laravel docs, the Laravel version is 5.4. Everything worked fine so far now I add these lines into my view: <!-- let people make clients --> <passport-clients></passport-clients> <!-- list of clients people have authorized to access our account --> <passport-authorized-clients></passport-authorized-clients> <!-- make it simple to generate a token right in the UI to play with --> <passport-personal-access-tokens></passport-personal-access-tokens> The Ui

Laravel passport auth through CreateFreshApiToken always returns {“message”:“Unauthenticated.”}

放肆的年华 提交于 2019-12-08 18:23:27
I am trying to allow my users, once they are logged in, to consume my own API through Javasscript as described there https://laravel.com/docs/5.7/passport#consuming-your-api-with-javascript I have installed Passport. My web middleware is defined as 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Barryvdh\Cors\HandleCors::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware

Laravel Passport column \“api_token\” does not exist

岁酱吖の 提交于 2019-12-08 15:19:03
问题 I am setting up laravel passport on a api project. I try to follow the steps on this site but couldn't get the authenication to work. The requesting a token part seems to work fine. When making a call to http://127.0.0.1:8000/oauth/token, it return a valid token. When I send a request to the api with the token in the Authorization Header, it gives a column "api_token" does not exit error Authorization Header: Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni........ Error: "SQLSTATE

Laravel passport auth through CreateFreshApiToken always returns {“message”:“Unauthenticated.”}

大城市里の小女人 提交于 2019-12-08 07:27:05
问题 I am trying to allow my users, once they are logged in, to consume my own API through Javasscript as described there https://laravel.com/docs/5.7/passport#consuming-your-api-with-javascript I have installed Passport. My web middleware is defined as 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Barryvdh\Cors\HandleCors::class, // \Illuminate\Session\Middleware

Laravel Passport - Guest Token

人盡茶涼 提交于 2019-12-08 04:58:40
问题 Let's assume there is an application with 10 dynamic pages (probably forms) out of which, 8 pages are restricted (requires user to login in application) and 2 pages are available for anonymous users. My front end application is in Angular 2 and back-end API is developed in Laravel 5.4. I'm more fascinated towards JWT tokens and found that, laravel has in-built support through passport. Questions: I can easily use password grant tokens for those 8 restricted page. But how do I give guest token

Authorization Policies/Gates for Laravel 5.3 web app consuming own API w/ Passport

大憨熊 提交于 2019-12-08 04:18:17
问题 Using Laravel 5.3 I've set up a web app that consumes its own API. Authentication successfully handled by Passport. Web app uses auth middleware in routes and Model Policies for authorization. API routing uses default 'auth:api' token guard to control access. I would like to use the same Policies in app/Policies for API authorization as well as the web auth, but I don't understand how. Calls such as $this->authorize('view', $model) do not work. I guess I need to pass the user from Auth::guard

Laravel Broadcast - Combining multiple middleware (web, auth:api)

末鹿安然 提交于 2019-12-08 01:45:06
问题 I am using Laravel Event Broadcast and Pusher to utilize websockets both on my API and Web. If I try them individually, both work fine. What I mean is: Broadcast::routes(['middleware' => 'web']); // this works for my Laravel website Broadcast::routes(['middleware' => 'auth:api']); // this works for my api However, if I want to use both at the same time like this: Broadcast::routes(['middleware' => ['auth:api', 'web']]); // doesn't work ... it crashes for both, which I suspect that it is