gitee-oauth
v1.0.3
Published
gitee 授权登录
Downloads
7
Readme
gitee-oauth
安装
npm i gitee-oauth -S
使用
import GiteeOauth from 'gitee-oauth'
const giteeOahtu = new GiteeOauth({
clientId: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
clientSecret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
})
// 未登录时跳转至授权登录页面
giteeOahtu.goOauthPage()
// 登录成功会回调原来的地址,并携带参数code,可通过code参数获取access_token
const access_token = await giteeOahtu.getAccessToken(code)
// 根据access_token请求用户信息
const userInfo = await giteeOahtu.getUserInfo(access_token)