我正在使用nuxt-strapi,我是通过动态口令进行身份验证的用户,为此,我想使用$strapi.login(),但问题是strapi登录的默认端点是auth/local,这需要电子邮件和密码,但我想修改它并使用手机号码。我不知道如何修改路由,所以有没有像在$auth中那样的选项,我可以修改登录路由
发布于 2021-02-12 15:16:07
nuxt-strapi模块不允许您更改登录URL。在您的示例中,我要做的是直接调用OTP API端点并手动设置令牌。
const token = await this.$strapi.$http.$post('otp/endpoint', {tel})
await this.$strapi.setToken(token)
await this.$strapi.fetchUser() //to get the user information
//or get the user via $http and set it manually
this.$strapi.setUser(user)有关更多信息,请参见https://strapi.nuxtjs.org/strapi
https://stackoverflow.com/questions/66166063
复制相似问题