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 孟德尔随机化结果不一致
  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法