There are commented code for OAuth 1 and xAuth in AuthorizeActivity (and TestActivity accordingly). They are obsolete and don't bother trying to get it to work (at least not OAuth1 as it seems only OAuth 2 is allowed from now on by Sina).
The OAuth 2 SDK code is very much similar to Facebook's SDK for as much as having been seen.
The demo itself should just work with only the following change after encountering bizarre behaviors, such as getting "Sorry, the page doesnot exist" after putting down Weibo account login.
private class WeiboWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
...
if (url.startsWith("https://api.weibo.com/oauth2/" + mWeibo.getRedirectUrl())) {
...
}
...
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
...
if (url.startsWith("https://api.weibo.com/oauth2/" + mWeibo.getRedirectUrl())) {
...
}
...
}
...
}
Otherwise, mWeibo.getReidrectUrl always returns the callback url and the condition is never ture, so handleRedirectUrl is never called and further callbacks never get back up.
Update: Also the documentation (.docx) of the example authorization steps are again out of date and only compatible with OAuth 1.
Very poorly maintained code and documentation!
2 comments:
If i put my app_key and app_secret instead of those they have on their example code, i keep getting an redirect_uri_mismatch error, even though i keep the same url "http://www.sina.com"
Did you manage to make this code work for you, if yes, could you please help me with a build or something?
email: rosu_alin@ymail.com
Also i don't know chinese, so this is kind of hard for me
If i put my app_key and app_secret instead of those they have on their example code, i keep getting an redirect_uri_mismatch error, even though i keep the same url "http://www.sina.com"
Did you manage to make this code work for you, if yes, could you please help me with a build or something?
email: rosu_alin@ymail.com
Also i don't know chinese, so this is kind of hard for me
Post a Comment