簡體   English   中英

如何修改 nuxt 中的 $strapi.login({}) 默認路由(自定義登錄)

[英]how to modify the $strapi.login({}) default route in nuxt(custom login)

我正在使用nuxt-strapi並且我是 otp 的身份驗證用戶,為此我想使用$strapi.login()但問題是strapi登錄的默認端點是 auth/local 這需要 email 和密碼,但我想修改它並使用手機號碼。 我不知道如何為此修改路由,所以有沒有像 $auth 這樣的選項我可以修改登錄路由

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM