laravel-passport

Laravel 5.3 Personal access token 500

陌路散爱 提交于 2019-12-06 03:23:32
问题 I'm trying to set up my custom API with Passport (well, I'm already halfway through, just need to build my authentication). Whenever I'm trying to create a personal access token from my Passport dashboard (/home route), I get a 'Whoops, something went wrong!' error. This comes from my Vue component (PersonalAccessTokens.vue), and my console logs me a 500 internal server error at the Post route for storing personal access tokens... \Laravel\Passport\Http\Controllers

Laravel Passport Password Grant Refresh Token

我是研究僧i 提交于 2019-12-06 00:24:01
问题 Trying to wrap my head around using Laravel's Passport with mobile clients. The Password Grant type of authentication seems to be the way to go, and i have it working with my iOS app, however i can't get token refreshing to work. When authenticating i get a token and a refresh token which i store, however when the token expires, calling the oauth/token/refresh route doesn't work. The route is using the web middleware which means my app using the api route can't access it. I'm not sure if they

Laravel 5.6 Passport OAuth Max Login Attempts

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 23:54:29
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 searching all around the interwebs but until now i couldn't find anything regarding Passport OAuth. I've

laravel passport returns unauthenticated

一曲冷凌霜 提交于 2019-12-05 12:59:46
I'm creating an api that uses Passport to manage authentication. I've set up Passport with the docs . The problem I am unable to login. I keep getting a JSON response saying unauthenticated Database In my database I have the following data: users id name email password timestamps 1 admin admin@admin.com $2y$10$mUu5KZdQhJ6qeyCeXsr9De0J9e8rgClILbhsGmnPpStwr1rhaa2je 2016-12-09 09:47:39 2016-12-09 09:47:39` ` oauth_clients id, user_id, name, secret, redirect, personal_access_client, password_client, revoked, created_at, updated_at 1, , Leerplatform app Password Grant Client,

Laravel passport gives 401 Unauthenticated error

房东的猫 提交于 2019-12-05 08:45:58
问题 I'm using Laravel passport for API authentication, it works perfectly when I use it with one DB, but gives 401 when using multiple databases, What I'm doing: I have a multi-tenant DB, master DB have users, roles and all OAuth tables. When I create a user with admin role it will create new DB with admin name, it will create sub DB with users, roles and all OAuth table. oauth_clients of sub DB will copy Password Grant Token and Personal Access Token from master DB and insert in sub DB, and also

Laravel Passport Multiple Authentication using Guards

眉间皱痕 提交于 2019-12-05 08:26:45
问题 Can we use laravel passport with different guards to authenticate APIs for two different types of users. For example we have driver app for driver user and vendor app for vendor user. Both have their different models Driver and Vendor. How can we use different guards to authenticate both types of users using Laravel Passport? 回答1: Here is an example of auth.php and api.php to start with config/auth.php <?php return [ /* |------------------------------------------------------------------------

Laravel Passport tokensExpireIn seems not working

痴心易碎 提交于 2019-12-05 03:23:51
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. Personal access tokens are always long-lived . Their lifetime is not modified when using the tokensExpireIn or refreshTokensExpireIn methods - as explained in Laravel's official documentation ( https:/

Laravel Passport Password Grant Tokens: own mobile app

依然范特西╮ 提交于 2019-12-05 02:52:55
问题 so my mobile app would be the client, i generated a client_id and a client_secret for it. users who uses the mobile app have to login using their username/password. Where should i store the client_id and client_secret? is it ok to expose them and simply place them hardcoded in the app? 回答1: It is definitely not the secure way of hardcoding them and just placing them in an app. Actually its not that straight forward. I assume you created the client from artisan or from the pre-built Vue

Laravel 5.3 Passport Custom Grants?

耗尽温柔 提交于 2019-12-05 00:51:53
I know I am not the only person who has come up to this point. Does anyone know how to properly implement a custom grant in Laravel(5.3) Passport? Or Have a good link/tutorial to reference how to properly do it? I know there's this package: https://github.com/mikemclin/passport-custom-request-grant But I'm asking for a more "Do it yourself" approach. Thank you in advance. Francisco Daniel namespace App\Providers; use App\Auth\Grants\FacebookGrant; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Laravel\Passport\Bridge\RefreshTokenRepository; use Laravel

How to get current user in Laravel API using Passport?

你离开我真会死。 提交于 2019-12-04 22:56:53
问题 I am using passport package for Laravel API Authentication. When I post data I get error: 401 Unauthorized","error":{"error":"Unauthenticated."}. I use Auth::user()->id; to get current user id. How to solve this error? 回答1: This code helped me: auth()->guard('api')->user() 回答2: The simplest format is auth('api')->user(); 回答3: When you use Auth::user()->id in your function's body. You have not logged in before. Please call login api first to get token then set it to the next API call. 来源: