简体   繁体   English

如何在 Jwt 模式下在 AdonisJs 中验证没有密码的用户?

[英]How can authenticate an user without password in AdonisJs in Jwt mode?

how can authenticate users without password in AdonisJs in jwt mode?如何在 jwt 模式下在 AdonisJs 中验证没有密码的用户?

i work with sms verification code.if code match, user is authenticated.我使用短信验证码。如果验证码匹配,则用户通过身份验证。 so dont need to password.所以不需要密码。 but adonis jwt attempt method need password.但是adonis jwt attempt方法需要密码。

just use只是使用

await auth.generate(user);

example:例子:

async login({request, response, auth}) {
    const {verification_code, mobile} = request.all();
    let user = await User.findBy('mobile', mobile);
    if (user && await Hash.verify(verification_code, user.verification_code)) {
        response.json(await auth.generate(user));
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bitvise SSH服务器如何在没有密码的情况下对用户进行身份验证? - How does Bitvise SSH Server authenticate user without a password? 使用管理员权限,如何在没有密码的情况下验证或登录用户帐户? - Using admin permission, how to authenticate or logged into the user account without a password? 验证后无密码验证用户一次 - Authenticate user without password once after verification 如何使用用户名/密码通过Devise和Android认证用户? - How can I authenticate a user with Devise and Android using username/password? 在没有数据库的情况下验证PostgreSQL用户和密码 - Authenticate PostgreSQL user and password without database 在Laravel中尝试在没有密码的情况下对用户进行身份验证 - Trying to Authenticate user without password in Laravel 如何使用 JWT 令牌而不是用户名、密码对 Openfire XMPP 进行身份验证 - How to authenticate Openfire XMPP with JWT token instead of username, password 如何在没有用户名和密码的情况下验证移动应用程序? - How to authenticate a mobile App without username and password? 如何在不登录的情况下验证用户身份 - How to authenticate user without login 如何使用 email 和密码验证我的用户? - How to Authenticate my user using email and password?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM