laravel-passport

error status 401 error unauthenticated laravel passport

巧了我就是萌 提交于 2019-12-13 00:55:54
问题 This is my first time implementing laravel passport This is my config/auth.php 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'passport', 'provider' => 'users', ], ], and this is where my routes/api.php that are guarded by auth:api Route::group(['middleware' => ['auth:api']], function () { Route::resource('users','Users\AdminUsersController')->except([ 'create', 'edit' ]); }); and this is how I fetch the api fetchUsers: async function(page_url

Laravel Passport Auth Stuck when run on standalone project for password based token authentication

雨燕双飞 提交于 2019-12-12 19:42:15
问题 Laravel Passport Auth Stuck when run on self server and client in same project for password based token authentication LoginController public function authenticaterrr(Request $request) { $http = new Client(); try{ //dd("Hello"); $response = $http->post(url('oauth/token'), [ 'form_params' => [ 'grant_type' => 'password', 'client_id' => '2', 'client_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', // 'username' => $request->get('username'), // 'password' => $request->get('password'), 'username' =

Laravel Passport clients has user_id null

左心房为你撑大大i 提交于 2019-12-11 17:56:57
问题 I am making a react app that uses a laravel passport backend to get and post data from a database. I have full control over the app code and the laravel backend code. I can make an access token just fine, either using a client, or simply by issuing a user to make one, but I can't use this access token to access data, as described here. Sending such a request with the generated access token gives me a 401 every time. I believe My problem is when making clients. I have 2 clients (made when

Passport Package returning “Unauthenticated” Error

人走茶凉 提交于 2019-12-11 15:56:02
问题 I am using Passport Package for the API requests. It was working fine with my old server and the request was authenticated but since I have moved my application to a newer server I am receiving Invalid Token Error. Been searching on the google from last 2 days but didn't find any solution. The API successfully returning me the token but when I am using that token to authenticate the user it gives me "Unauthenticated" error and redirects me to Home. Everything is working fine on my old server.

Laravel Passport - /oauth/token generates invalid token

天涯浪子 提交于 2019-12-11 15:17:50
问题 So I created a client using php artisan passport:client , and when I do a POST request to oauth/token I thankfully get back a token. However, when I try to use that token by putting it in my headers and going to an auth:api protected route I get 401 unauthorized. Using a different route to login, however, seems to work. When I use this route in my api controller: Route::post('/login', 'Auth\LoginController@login')->name('login'); which has the following code: public function login(Request

Laravel passport trying to get oauth/token. Guzzle keeps hanging, also on other Guzzle calls

坚强是说给别人听的谎言 提交于 2019-12-11 14:32:40
问题 Set up a new project with Laravel 5.8 and I also installed Laravel Passport & Guzzle. Created a local server with php artisan serve on port 8000. Postman is able to get a response at /oauth/token (but only when the body is in JSON). When I try to access the API through a controller method my browser returns a 500 error and no errors are showing up in the logs. When I try to point guzzle to the same controller method through a route postman keeps loading and it's even needed to force close my

How to verify laravel passport api token in node / socket application?

孤街浪徒 提交于 2019-12-10 22:47:56
问题 My question is about OAuth passport token in laravel application which is using sockets / node express sever as well. I need to implement my authentication mechanizm on socket server. Something like this article: https://m.dotdev.co/authenticate-laravel-5-user-account-in-nodejs-socket-io-using-json-web-tokens-jwt-f74009d612f8. Already Im building this mechanism with my own token. But I would prefer to use token generated for my Laravel API. My point is how is this token builded ? Which fields

Keeping logged in user information

冷暖自知 提交于 2019-12-10 21:06:01
问题 I managed to log in with laravel passport. I have the token, great. But I want to keep logged in user information, name, avatar and so on. My login procedure gets oauth token. In dashboard component I make api call for user data. Should I keep them in global Vue object or use Vuex? Is it safe? 回答1: Some options you might consider store data in cookies use localStorage keep everything in the root vue instance keep everything in a wrapping vue component My suggestion would be to store the auth

Confusing how Laravel passport API security works

醉酒当歌 提交于 2019-12-10 14:19:05
问题 Client sends username and password to the server. Server then checks if this user is authenticated. If yes, the server returns an access token for the client... Then user can use this access token to access protected resources... The advantage here, is that we are not sending user info via API calls, and the access token will not last for long time, so hackers won't be able to find out user authentication info (user name and password), and if he finds out, the access token won't last long

Return the access token and the user when authenticating using Passport and Laravel

回眸只為那壹抹淺笑 提交于 2019-12-10 13:45:46
问题 I am creating an API using Laravel 5.4 and Passport. The API authorization is done using Password grant type. Below is a sample request: $http = new GuzzleHttp\Client; $response = $http->post('http://your-app.com/oauth/token', [ 'form_params' => [ 'grant_type' => 'password', 'client_id' => 'client-id', 'client_secret' => 'client-secret', 'username' => 'taylor@laravel.com', 'password' => 'my-password', 'scope' => '', ], ]); return json_decode((string) $response->getBody(), true); This will