laravel-passport

Laravel 5.6 Passport OAuth Max Login Attempts

梦想的初衷 提交于 2019-12-22 09:50:09
问题 I've just created a simple OAuth system with Laravel Passport. This system will be responsible for an external app user registration and authentication. Everything is working as i expect, and now i would like to implement a mechanism to lock users after a predefined number of failed login attempts. I'm new to Laravel and Passport, is there any built in package that can manage this for me? Or do I have to develop this feature on my own? If so, how can i accomplish such task? I've been

Server Freezing when using Passport Password Grants and/or Guzzle

我只是一个虾纸丫 提交于 2019-12-22 08:35:41
问题 We're adapting a laravel website into a laravel SPA, and in the future, a Mobile App that uses the web app, so we need some sort of API authentication. We're using Laravel Passport for that. I've been using Laravel 5.5 and following the guide on the Docs, but when I try using the new login with postman, the server freezes, the HTTP requests never processing. After some debugging, I found out that it crashes when I use Guzzle to post into the /oauth/token route. But when I use Postman to

laravel passport revoke and prune event listener is not doing anything

我是研究僧i 提交于 2019-12-21 06:29:22
问题 I've added this two event listeners to my : EventServiceProvider /** * The event listener mappings for the application. * * @var array */ protected $listen = [ 'Laravel\Passport\Events\AccessTokenCreated' => [ 'App\Listeners\RevokeOldTokens', ], 'Laravel\Passport\Events\RefreshTokenCreated' => [ 'App\Listeners\PruneOldTokens', ], ]; And in my AuthServiceProvider I have : public function boot() { $this->registerPolicies(); Passport::routes(); passport::$revokeOtherTokens; passport::

How to add status in default response passport

China☆狼群 提交于 2019-12-19 10:22:38
问题 I am developing and application in web as well as App. For App's API I have use Passport in laravel. Using passport i can create token and using that token I verify user for other api access. But if token in invalid then it return Error message like "Unauthorized" without any status. Can any one tell me what to do if i want to add error status like 401 with message "Unauthorized" . Where I have to change in code so that my web code is not affect. I want json response like below with 2 fields

composer unable to install laravel/passport

拟墨画扇 提交于 2019-12-18 07:35:33
问题 I have created a new project with laravel new blogposts using "Laravel Installer 2.0.1" globally installed on my ubuntu 18. When i trying to install passport using composer require laravel/passport following errors are their Using version ^6.0 for laravel/passport ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - Conclusion:

Laravel 5.4 passport axios always returns Unauthenticated

元气小坏坏 提交于 2019-12-18 05:06:12
问题 I've followed the guide here:https://laravel.com/docs/5.4/passport#consuming-your-api-with-javascript Using axios: ... mounted: function() { axios.get('/api/user') .then(function (response) { console.log(response) }) .catch(function (response) { console.error(response); }); }, But the response is always unauthenticated, I check to see if a laravel_token cookie is present and it is: I'm running on apache2 ( docker ) ---- Update -- Upon debugging, its actually the xsrf token thats failing in

Error: Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response

让人想犯罪 __ 提交于 2019-12-17 20:24:08
问题 I am building my application in Angular 2 and Laravel 5.4. Angular2 is for client side and laravel 5.4 is for server side. I created APIs in laravel and requesting those APIs from Angular2. In Laravel, I configured Oauth 2 passport service which is authenticating all APIs. In each API call I am sending below headers. 'Content-Type', 'Authorization' The way how I am calling APIs with headers. private headers = new Headers({'Content-Type': 'application/json', 'Authorization': 'Bearer ' +

Get user data using access token in laravel passport client app

眉间皱痕 提交于 2019-12-17 10:46:43
问题 I have successfully created server.app and client.app using Laravel Passport documentation . Everything works as expected. client.app Route: Route::get('callback', function (Request $request) { $http = new GuzzleHttp\Client; $response = $http->post('http://server.app/oauth/token', [ 'form_params' => [ 'grant_type' => 'authorization_code', 'client_id' => 3, 'client_secret' => 'secret', 'redirect_uri' => 'http://client.app/callback', 'code' => $request->code ] ]); return json_decode((string)

Registering User with Laravel Passport

帅比萌擦擦* 提交于 2019-12-17 10:37:25
问题 I set up password grant (it's backend for an app). Now, I can send a post request to oauth/token and it works on Postman. However, what if I want to register user from the api too? I understand I can use current /register route, however, then will I need to redirect the user back to the login page and he logs in again with his credentials? Or in the RegisterController, in registered() function, should I do I redirect to the oauth/token route? (For this, please note that I am sending, all the

Laravel 5.6 Login Attempt Fails - Method RequestGuard::attempt does not exist is returned on Login Submit

Deadly 提交于 2019-12-13 05:50:27
问题 I had implemented multi-auth for my application and it was working fine until it just stopped.I've scoured the internet for a solution but to no avail. So I do have Admin Login Controller and the default Laravel Login controller which uses make:auth and implements authenticable for users. My admin login is working fine but the user login fails and returns this BadMethodCallException Method Illuminate\Auth\RequestGuard::attempt does not exist. The same thing happens when I try to register a