草庐IT

koa-passport

全部标签

php - Composer 无法安装 laravel/passport

我创建了一个新项目laravelnewblogposts使用全局安装在我的ubuntu18上的“LaravelInstaller2.0.1”。当我尝试使用安装护照时composerrequirelaravel/passport以下是他们的错误Usingversion^6.0forlaravel/passport./composer.jsonhasbeenupdatedLoadingcomposerrepositorieswithpackageinformationUpdatingdependencies(includingrequire-dev)Yourrequirementscoul

node.js - koa:mongodb/redis 事件连接计数不断增加

我正在使用中间件像这样传递我的mongodb/redis客户端实例:function*middleware(next){//allowdownstreamtohandledbconnectionerrorgracefullytry{this.db=yieldmongodb.apply(this);}catch(err){this.db=false;this.app.emit('error',err,this);}try{this.redis=yieldredis.apply(this);}catch(err){this.redis=false;this.app.emit('error'

node.js - 如何获取 Koa 服务器 url 路由列表

我正在使用koajs开发一个模拟服务器,我想发布一个列出已开发API的服务。我使用koa-router进行mouting服务。我想要一些像这样的想法:varbusiness_router=require('./controllers/router');app.use(business_router.routes());app.use(business_router.allowedMethods());console.log(app.listRoutes()); 最佳答案 虽然我猜它不是官方koa-routerAPI的一部分,你可以这

javascript - Koa框架中JavaScript函数定义中的星号(*)是什么意思?

这个问题在这里已经有了答案:Whatis"function*"inJavaScript?(4个答案)关闭8年前。我一直在熟悉Koa(http://koajs.com/)。许多例子都用星号代替了函数名。例如在HelloWorld的例子中有:varkoa=require('koa');varapp=koa();app.use(function*(){this.body='HelloWorld';});app.listen(3000);这颗星是什么意思?

php - 如何使用 Passport 在 Laravel API 中获取当前用户?

我正在使用护照包进行LaravelAPI身份验证。当我发布数据时出现错误:401Unauthorized","error":{"error":"Unauthenticated."}.我使用Auth::user()->id;获取当前用户ID。如何解决这个错误? 最佳答案 这段代码帮助了我:auth()->guard('api')->user()对于短线语法,你可以使用这样的东西:auth('api')->user() 关于php-如何使用Passport在LaravelAPI中获取当前用户

php - 如何使用 Passport 刷新 API 调用的 laravel_token

我使用Laravel5.6、Vue2.5和LaravelPassport创建了一个SPA,运行良好。我真的很喜欢Laravel和Vue,因为它们使使用API构建SPA变得非常简单且充满乐趣。按照thedocs中的描述设置LaravelPassport之后基于正确返回并存储在cookie中的“laravel_token”,登录以及对API的调用按预期工作。但是,我的问题是我的用户使用该应用程序已经很长时间了,没有重新加载页面,而是仅使用axios对API执行调用。不知何故,Laravel不会在API调用中刷新“laravel_token”(和相应的cookie)(当我调用“web”路由时

php - Laravel Passport 使用不同的模型

我想向Laravel添加一个自定义守卫,它使用Passport但具有不同的模型(不是用户),但是当我尝试为这个守卫设置用户时它不起作用。配置/auth.php:['guard'=>'web','passwords'=>'users',],/*|--------------------------------------------------------------------------|AuthenticationGuards|--------------------------------------------------------------------------||Ne

php - 拉维尔 5.3 : Passport Implementation - {"error" :"invalid_client" ,"message" :"Client authentication failed"}

我遵循了Laracast:What'sNewinLaravel5.3:LaravelPassport中提到的确切步骤使用oauth2实现api身份验证。我在客户端/消费者项目中的web.php文件如下所示:useIlluminate\Http\Request;Route::get('/',function(){$query=http_build_query(['client_id'=>2,'redirect_uri'=>'http://offline.xyz.com/callback','response_type'=>'code','scope'=>'',]);returnredir

php - 不同的 token 过期取决于客户端 Laravel Passport

我有一个使用Passport身份验证的Laravel应用程序。登录publicfunctionauthenticate(Request$request){$params=['grant_type'=>'password','client_id'=>1,'client_secret'=>"secret",'username'=>request('username'),'password'=>request('password'),'active'=>1,'scope'=>'*'];$request->request->add($params);//verifythecredentials

php - 找不到 Laravel Passport 安装类

我正在尝试配置我的Laravel应用程序以使用Passport,但在加载我的AppServiceProvider.php中的类时卡住了。这是我所做的...registerPolicies();Passport::routes();Passport::tokensCan(['client'=>'thisisaapiclienttest']);}}.['web'=>['driver'=>'passport','provider'=>'users',],],....[...Laravel\Passport\PassportServiceProvider::class,.....app->en