dongtieshang5429 2016-09-06 17:51
浏览 123
已采纳

Yii2登录无密码验证

I am working on project that will use API of another application. So I won't validate password on my app, will do this via API request. I don't want to store users` passwords in db. Just check password by API.

How can I authenticate a user without login credentials?

  • 写回答

2条回答 默认 最新

  • dtmooir3395 2016-09-06 18:32
    关注

    Login & Session in Yii 2 is managed by \yii\web\User class This class is accessible in the application life cycle via the \Yii::$app->user property.

    On successful authentication using your third-party provider you use the login() function using Yii::$app->user->login($identity)

    $identity should be an object of [IdentityInterface][4] usually the User ActiveRecord model implementing this interface

    Refer to the guide documentation on Authentication for full understanding on how authentication works in Yii2

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题