Skip to content

liyin/cordova_weibo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova_Weibo_Plugin

version platform GitHub license Contact

This is a Cordova Plugin for WeiboSDK. 简体中文
I also write a cordova plugin for qq sdk here.

Feature

  • Weibo SSO Login
  • Weibo Logout
  • Weibo WebPage Share
  • Check Weibo Client is Installed

Requirements

  • Cordova Version 3.5+
  • Cordova-Android >=4.0

Installation

  1. cordova plugin add https://github.com/iVanPan/cordova_weibo.git --variable WEIBO_APP_ID=YOUR_WEIBO_APPID or cordova plugin add cordova-plugin-weibosdk --variable WEIBO_APP_ID=YOUR_WEIBO_APPID
  2. 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
  3. cordova build

##Notes

  1. This plugin is required cordova-android version >=4.0,so using cordova 5.0.0 or higher is recommended
  2. This plugin should be used after the deviceready event has been fired!!!
  3. ~~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)

About iOS 9

###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.

Usage

Weibo SSO Login

YCWeibo.ssoLogin(function(args){
         alert(args.access_token);
         alert(args.userid);
      },function(failReason){
         console.log(failReason);
});

Weibo Logout

YCWeibo.logout(function(){
	console.log('logout success');
},function(failReason){
	console.log(failReason);
});

Weibo Webpage Share

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);

CheckClientInstalled

YCWeibo.checkClientInstalled(function(){
	console.log('client is installed');
},function(){
	console.log('client is not installed');
});

##Example

  1. install this plugin
  2. backup www folder in your cordova project
  3. replace www by example_www
  4. 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

About

This is a Cordova Plugin for WeiboSDK

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 75.3%
  • Java 17.7%
  • CSS 3.6%
  • JavaScript 2.1%
  • HTML 1.3%