예제 #1
0
  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) {}
        });
  }
예제 #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);
     }
 }
예제 #3
0
 private boolean startSingleSignOn(String s, String s1)
 {
     boolean flag = true;
     Intent intent = new Intent();
     intent.setClassName(s, s1);
     intent.putExtras(mWeibo.getAuthInfo().getAuthBundle());
     intent.putExtra("_weibo_command_type", 3);
     intent.putExtra("_weibo_transaction", String.valueOf(System.currentTimeMillis()));
     if (!SecurityHelper.validateAppSignatureForIntent(mAuthActivity, intent))
     {
         return false;
     }
     try
     {
         mAuthActivity.startActivityForResult(intent, mSSOAuthRequestCode);
     }
     catch (ActivityNotFoundException activitynotfoundexception)
     {
         flag = false;
     }
     mAuthActivity.getApplicationContext().unbindService(mConnection);
     return flag;
 }
예제 #4
0
 {
     LogUtil.d("Weibo_SSO_login", "Failed to receive access token by SSO");
     mWeibo.anthorize(mAuthListener);
     return;
 }