This is a Cordova Plugin for WeiboSDK. 简体中文
I also write a cordova plugin for qq sdk here.
- Weibo SSO Login
- Weibo Logout
- Weibo WebPage Share
- Check Weibo Client is Installed
- Cordova Version 3.5+
- Cordova-Android >=4.0
cordova plugin add https://github.com/iVanPan/cordova_weibo.git --variable WEIBO_APP_ID=YOUR_WEIBO_APPID
orcordova plugin add cordova-plugin-weibosdk --variable WEIBO_APP_ID=YOUR_WEIBO_APPID
- Add
<preference name="REDIRECTURI" value="YOUR_WEIBO_REDIRECTURI" />
in your config.xml If you don't add this preference the defualt redirecturi is https://api.weibo.com/oauth2/default.html - cordova build
##Notes
- This plugin is required cordova-android version >=4.0,so using cordova 5.0.0 or higher is recommended
- This plugin should be used after the deviceready event has been fired!!!
- ~~If cordova version <5.1.1,when two cordova plugins are modifying “*-Info.plist” CFBundleURLTypes, only the first added plugin is getting the changes applied.so after installing plugin,please check the URLTypes in your Xcode project.You can find this issue here.~~Update:This Bug is fixed in last cordova version(5.1.1)
###App Transport Security
iOS 9 introduces a new security feature that blocks non-HTTPS traffic in your app. However, WeiBo SDK not support HTTPS yet, this Plugin will turn off https and allow non-HTTPS traffic
##ISSUES 1.if you are sharing webpage without weibo app client ,the webpage sharing becomes text sharing.
YCWeibo.ssoLogin(function(args){
alert(args.access_token);
alert(args.userid);
},function(failReason){
console.log(failReason);
});
YCWeibo.logout(function(){
console.log('logout success');
},function(failReason){
console.log(failReason);
});
var args = {};
args.url = "http://www.baidu.com";
args.title = "Baidu";
args.description = "This is Baidu";
args.imageUrl = "https://www.baidu.com/img/bdlogo.png";//if you don't have imageUrl,for android http://www.sinaimg.cn/blog/developer/wiki/LOGO_64x64.png will be the defualt one
args.defaultText = "";
YCWeibo.shareToWeibo(function () {
alert("share success");
}, function (failReason) {
alert(failReason);
}, args);
YCWeibo.checkClientInstalled(function(){
console.log('client is installed');
},function(){
console.log('client is not installed');
});
##Example
- install this plugin
- backup www folder in your cordova project
- replace www by example_www
- cordova build & test
##About WeiboSdk you can downlaod last weibosdk here .if you find any problem about weibosdk, open an isssus please.
##About Get User Info after weibo sso Login,you can get access_token and userid,using get method to get user info directly with url https://api.weibo.com/2/users/show.json?uid=xxxx&access_token=xxxx