1.查看第三方文档获取AppID 和 AppSecret
2.a.引导用户点击按钮跳转至第三方指定网址(构造授权登录页面链接,b.确认授权之后会产生一个授权码(code),c. redirect_uri
携带至开发者的服务器(请求后端接口)。
<div class="btn-between" v-if="!phoneLogin">
<a
:href="feishuUrl"
class="el-button el-button--primary el-button--small"
>
<i class="UserFilled"></i>飞书登录</a
>
<el-button
:loading="loading"
type="primary"
size="small"
@click.native.prevent="
() => {
phoneLogin = true
}
"
>验证码登录</el-button
>
</div>
mounted() {
this.feishuUrl = `https://passport.feishu.cn/suite/passport/oauth/authorize?client_id=${'cli_a3333333333333c9100c'}&redirect_uri=${encodeURIComponent(
window.location.href
)}&response_type=code`
if (
this.$router.currentRoute.query &&
this.$router.currentRoute.query.code
) {
const feishuCode = this.$router.currentRoute.query.code
this.feishuLogin(feishuCode)
}
},