public void onAuthSina() {
    mAccessToken = AccessTokenKeeper.readAccessToken(context);
    mWeiboAuth = new WeiboAuth(act, APP_KEY, REDIRECT_URL, SCOPE);
    mWeiboAuth.anthorize(
        new WeiboAuthListener() {
          @Override
          public void onComplete(Bundle values) {
            mAccessToken = Oauth2AccessToken.parseAccessToken(values);
            if (mAccessToken.isSessionValid()) {
              mShareCalls.onAuthListener(mAccessToken);
              AccessTokenKeeper.writeAccessToken(context, mAccessToken);
            } else {
              mShareCalls.onAuthListener(null);
              String code = values.getString("code");
              String message = "";
              if (!TextUtils.isEmpty(code)) {
                message = message + "\nObtained the code: " + code;
              }
            }
          }

          @Override
          public void onCancel() {}

          @Override
          public void onWeiboException(WeiboException e) {}
        });
  }
Esempio n. 2
0
 public void authorize(int i, WeiboAuthListener weiboauthlistener, String s)
 {
     mSSOAuthRequestCode = i;
     mAuthListener = weiboauthlistener;
     if (!bindRemoteSSOService(mAuthActivity.getApplicationContext(), s) && mWeibo != null)
     {
         mWeibo.anthorize(mAuthListener);
     }
 }
Esempio n. 3
0
 {
     LogUtil.d("Weibo_SSO_login", "Failed to receive access token by SSO");
     mWeibo.anthorize(mAuthListener);
     return;
 }