iVanPan / cordova_weibo

A Cordova wrapper around the Sina WeiboSDK for Android and iOS. Provides access to ssoLogin, WeiboSharing etc...
MIT License
196 stars 87 forks source link

Cordova-Android7.0 微博登录分享失败 #58

Open danli92 opened 6 years ago

danli92 commented 6 years ago

跳转微博登录的时候出现 21324:unknown client id: XXX 的错误。 但是ios的微博登录分享都是成功的。

iVanPan commented 6 years ago

可能微博Appid 有问题

danli92 commented 6 years ago

APP_ID确定是对的,因为同样的ID, ios是成功可以用。 应该是string的id变成了unkown appid: 2.72414310E. 一脸科学计数法的样子

iVanPan commented 6 years ago

删除插件 重新 安装一下,注意一下appid

danli92 commented 6 years ago

并没有什么用。 重新安装了很多次

iVanPan commented 6 years ago

看一下 config.xml 里面的appid 都对不对的

rainfu commented 6 years ago

没什么用,最后直接在android代码里改死:)

@Override protected void pluginInitialize() { super.pluginInitialize(); APP_KEY = webView.getPreferences().getString(WEBIO_APP_ID, ""); APP_KEY="xxxxxxxxxxx"; REDIRECT_URL = webView.getPreferences().getString(WEBIO_REDIRECT_URL, DEFAULT_URL); WbSdk.install(WeiboSDKPlugin.this.cordova.getActivity(),new AuthInfo(WeiboSDKPlugin.this.cordova.getActivity(), APP_KEY, REDIRECT_URL, SCOPE));

另外,微博在ios能登录不能分享,不报错 @iVanPan

环境:cordova 7.1.0 / ios 4.5.4 /weibosdk 0.6.0

danli92 commented 6 years ago

在代码里改死没效果。 cordova 7.0.0+ 是怎么安装 weibosdk 0.6.0?

这个改的是哪里的config.xml? 试了几个地方,改了没有用
iVanPan commented 6 years ago

@rainfu 不能分享 是分享什么? 图片 还有网址的 url 长度过长 会无法分享的

danli92 commented 6 years ago

这么个东西弄了半天,还是改plugins的源码。删Android文件夹,重新build Android。 image 这句获取的WEIBO_APP_ID有问题

iVanPan commented 6 years ago

@danli92 做了一下测试 我的AppId 应该没有问题,估计你的AppID 大于等于11位了,Cordova 的那个API内部转化就出错了 于是就变成那个样子了

danli92 commented 6 years ago

@iVanPan 确实是这个问题。

cxcxcxcx commented 5 years ago

我也是同样的问题,用的很 hacky 的办法解决的: https://github.com/iVanPan/cordova_weibo/compare/master...cxcxcxcx:master

azureland commented 5 years ago

同样的问题,我的appid 是 10位的数字,打印了一下 log ,拿到 app_key 是 3.621254E9,应该是 cordova 当成了数字来处理了。

@cxcxcxcx 的 PR 应该是可以的。

lovelyelfpop commented 5 years ago

是不是appid是纯数字?插件参数值前面加个 \ 看看,比如 <preference name="WEIBO_APP_ID=YOUR_WEIBO_APPID" value="\1324132515235" />

azureland commented 5 years ago

是不是appid是纯数字?插件参数值前面加个 \ 看看,比如 <preference name="WEIBO_APP_ID=YOUR_WEIBO_APPID" value="\1324132515235" />

是纯数字的,就加个 \ , 其他都不用改吗?

lovelyelfpop commented 5 years ago

@azureland 我用小米魅族推送的时候,也是纯数字的appid,java取值的时候会认为是整数,我在插件参数值前面加了\就好了,得到的是字符串

cxcxcxcx commented 5 years ago

加\会 break iOS 版本,要不我还是发个 pull request 吧

ERROR ITMS-90158: "The following URL schemes found in your app are not in the correct format: [wb\40328.....]. URL schemes need to begin with an alphabetic character, and be comprised of alphanumeric characters, the period, the hyphen or the plus sign only. Please see RFC1738 for more detail."