laravel-passport

Laravel 5.6 Passport oAuth2 can't make request with Guzzle

断了今生、忘了曾经 提交于 2021-02-08 07:49:08
问题 I have a fresh project on Laravel 5.6, where I'm trying to study and understand API Auth with Passport. I'm trying to do that, and after that to make a Javascript application from where I'll access that API. So, API for first-party applications. I've installed and registered all routes and setup specific to passport, and also installed Guzzle . I looked for some tutorials and now I'm with that code : RegisterController.php <?php namespace App\Http\Controllers\Api\Auth; use App\Http

Laravel 5.6 Passport oAuth2 can't make request with Guzzle

亡梦爱人 提交于 2021-02-08 07:47:41
问题 I have a fresh project on Laravel 5.6, where I'm trying to study and understand API Auth with Passport. I'm trying to do that, and after that to make a Javascript application from where I'll access that API. So, API for first-party applications. I've installed and registered all routes and setup specific to passport, and also installed Guzzle . I looked for some tutorials and now I'm with that code : RegisterController.php <?php namespace App\Http\Controllers\Api\Auth; use App\Http

Fleet cart using middlewares in routes but i can not find any $routemiddleware in project…not even in kernel.php …where can i find it?

▼魔方 西西 提交于 2021-02-08 02:12:43
问题 Fleet cart using middlewares in routes but i can not find any $routemiddleware in project...not even in kernel.php ...where can i find it? Laravel Version : 5.7 Passport Version : 7.5 CMS : FleetCart Kernel.php namespace FleetCart\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The application's global HTTP middleware stack. * * These middleware are run during every request to your application. * * @var array */ protected $middleware = [

Using Laravel Passport with mobile application

情到浓时终转凉″ 提交于 2021-02-04 14:18:06
问题 I am making a mobile application with a laravel API, and I saw that since Laravel 5.3(?) they added something called "Passport" which handles OAuth2/verification for an application, so I thought I would give that a try. I followed several different explanations for how to get it working after I completed the setup using the Laravel Passport documentation (https://laravel.com/docs/5.4/passport). Right now this is the code for what I've come up with based off other tutorials/ SO articles 1.)

Laravel Passport: How to validate client IP when requesting API

半腔热情 提交于 2021-01-29 13:14:04
问题 I'm using Laravel Passport as my API authentication mechanism. Everything is working as expected, but i need to add an extra validation for each request. The idea is to validate the client IP Address alongside the access_token that is sent to the server. Any idea how i can accomplish this? UPDATE: I want to check if the IP used in the authentication (when the user logged in) is the same as the one doing the requestes. If the IP is different, the client must login again. 回答1: Ip address could

How to use Laravel Passport access tokens

随声附和 提交于 2021-01-29 08:14:03
问题 First let me describe the problem I want to solve. I have a Laravel backend project that I want to tranform into an API, and it looked like Laravel Passport was perfect for this. Therefore, I installed Laravel Passport into my project. I have a client app which needs to use this API using axios. What I want to do is to make a post request with my username and password to the API to get an access token, and then use this access token to get or post relevant data. The access token is created by

Laravel Passport suddenly returning 401 on Vue/Axios API calls

南楼画角 提交于 2021-01-28 21:55:37
问题 My application has an API that I consume from my JavaScript/Vue front end. Recently, I (unrelated) tried to unsecure Valet in order to share the site to perform webhook tests. I received a Brew 'Unable to determine linked PHP' error. Long story short I restored the symlink, updated composer dependencies and resecured Valet to ensure nothing was broken. Upon loading my application, all calls to my Laravel Passport secured API are returning 401. My unit tests are all passing, so the non

Laravel Passport - Feature test returns unauthorized 401

倾然丶 夕夏残阳落幕 提交于 2021-01-28 03:06:00
问题 I'm trying to test my login endpoint where a successful response would return the access_token among other things. I'm using RefreshDatabase , so I changed the login method on the controller to retrieve the client_secret via a DB call. I tested with a dd() and I can confirm that the client_secret changes on each phpunit run in the terminal. The credentials are correct and the API endpoint works - just not when it's run via a test. For example, I have the passport tables set up on my mysql

Laravel Passport: Missing keys after deployment to aws

陌路散爱 提交于 2021-01-27 20:06:26
问题 I'm having trouble setting up laravels passport on aws elastic beanstalk. The eb client is set up correctly and I can deploy code changes. No errors are shown. However making requests to laravel results in error 500 afterwards, telling me I'm missing the passport keys in "app/current/storage/oauth-public.key\". Locally everything runs fine. I guess I'm missing the artisan command "php artisan passport:install", so I added it in the composer file: "post-install-cmd": [ "Illuminate\\Foundation\

Laravel Passport: Target [Lcobucci\JWT\Parser] is not instantiable while building [Laravel\Passport\PersonalAccessTokenFactory]

五迷三道 提交于 2021-01-27 13:50:24
问题 It's my first time trying out this package and I followed the installation guide at https://laravel.com/docs/8.x/passport but when this code block in my controller signup action it throws the error: $token = $user->createToken('authToken')->accessToken; Here's the code for my signup action: public function signup(Request $request){ $request->validate([ 'name' => 'required', 'email' => 'required|string|email:rfc,dns|unique:users', 'password' => 'required|string|confirmed' ]); $user = new User(