sd-sina-account

水滴微博登录

Usage no npm install needed!

<script type="module">
  import sdSinaAccount from 'https://cdn.skypack.dev/sd-sina-account';
</script>

README

sd-sina-account

水滴微博登录

INSTALL

yarn add sd-sina-account

USEAGE

import account from 'sd-sina-account' 

Vue.use(account, {
  appid: '新浪开放平台App Key',
  thirdType: 372,
  redirectUri: '应用地址回调,需要与开放平台中配置一致',
  url: '回调参数'
})

// 登陆
this.$sdSinaAccount.login().then((res) => {
  console.log('login success')
}).catch(e => {
  console.log('login fail')
})

// 或者重置参数:
this.$sdSinaAccount.login({
  appid: '',
  thirdType: 0,
  redirectUri: '',
  url: '回调参数'
}).then((res) => {
  console.log('login success')
}).catch(e => {
  console.log('login fail')
})

API

//登录
// 方式:异步
// setting 需传参数
// 必传项: appid, thirdType, redirectUri
login(setting)

// 是否登陆
// 方式:同步
isLogin()

// 登录,验证当前url中的code,根据code判断是否调用登录
loginWithCode(setting)