当前位置: 首页>>代码示例>>Java>>正文


Java SsoHandler.authorize方法代码示例

本文整理汇总了Java中com.sina.weibo.sdk.auth.sso.SsoHandler.authorize方法的典型用法代码示例。如果您正苦于以下问题:Java SsoHandler.authorize方法的具体用法?Java SsoHandler.authorize怎么用?Java SsoHandler.authorize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sina.weibo.sdk.auth.sso.SsoHandler的用法示例。


在下文中一共展示了SsoHandler.authorize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: allInOneShare

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
private void allInOneShare(final WeiboMultiMessage weiboMessage) {
    final String token = getToken();
    if (TextUtils.isEmpty(token)) {
        mWeiboMessage = weiboMessage;
        Log.d(TAG, "authorize when allInOneShare");
        mSsoHandler = new SsoHandler((Activity) getContext());
        mSsoHandler.authorize(mAuthListener);
    } else {
        mWeiboMessage = null;
        mSsoHandler = null;
        doOnMainThread(new Runnable() {
            @Override
            public void run() {
                postProgressStart();
                Log.d(TAG, "share message when allInOneShare");
                mShareHandler.shareMessage(weiboMessage, false);
            }
        });
    }
}
 
开发者ID:Bilibili,项目名称:BiliShare,代码行数:21,代码来源:SinaShareHandler.java

示例2: weiboLogin

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
/**
 * 微博登陆
 */
private void weiboLogin(){
    mAuthInfo = new AuthInfo(this, Constants.WEIBO_APP_KEY, Constants.WEIBO_REDIRECT_URL, Constants.WEIBO_SCOPE);
    mSsoHandler = new SsoHandler(this, mAuthInfo);
    // Web授权
    //mSsoHandler.authorizeWeb(new LoginWeiboAuthListener());
    // SSO授权
    //mSsoHandler.authorizeClientSso(new LoginWeiboAuthListener());
    // All in one
    // 此种授权方式会根据手机是否安装微博客户端来决定使用sso授权还是网页授权,
    // 如果安装有微博客户端 则调用微博客户端授权,否则调用Web页面方式授权
    try {
        mSsoHandler.authorize(new LoginWeiboAuthListener());
    }catch (Exception e){
        Log.e(TAG, "weibo login exception: " + e.getMessage());
    }
}
 
开发者ID:zjupure,项目名称:SneezeReader,代码行数:20,代码来源:MainActivity.java

示例3: login

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
@Override
public void login(PlatformActionListener platformActionListener) {
    mPlatformActionListener = platformActionListener;
    AccessTokenKeeper.clear(mContext);
    mAuthInfo = new AuthInfo(mContext, mSinaAppKey, mRedirectUrl, SCOPE);
    mSsoHandler = new SsoHandler((Activity) mContext, mAuthInfo);
    mSsoHandler.authorize(new AuthListener());

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:WeiboLoginManager.java

示例4: shareToWeibo

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
private void shareToWeibo() {
    mAccessToken = AccessTokenKeeper.readAccessToken(mContext);
    if (mAccessToken != null) {
        StatusesAPI statusAPI = new StatusesAPI(mContext, Constants.WEIBO_APPKEY, mAccessToken);
        statusAPI.update(shareText + mContext.getResources().getString(R.string.shareDescription) + shareLink, "0.0", "0.0", weiboListener);
        //statusAPI.uploadUrlText("分享一个音乐播放器,http://www.lingjutech.com", "http://tp3.sinaimg.cn/1706684510/50/22818070132/1", "", "0.0", "0.0", weiboListener);
    } else {
        AccessTokenKeeper.clear(mContext);
        Log.i(TAG, "Context=" + mContext);
        AuthInfo authInfo = new AuthInfo(mContext, Constants.WEIBO_APPKEY, Constants.REDIRECT_URL, Constants.SCOPE);
        //			WeiboAuth weiboAuth = new WeiboAuth(mContext, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
        mSsoHandler = new SsoHandler((Activity) mContext, authInfo);
        mSsoHandler.authorize(new AuthListener());
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:16,代码来源:BaseDialog.java

示例5: onClick

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    if (v.getId() == R.id.signin_btn) {  // sign in
        AuthInfo authInfo = new AuthInfo(this, WeiboData.APP_KEY, WeiboData.REDIRECT_URL, WeiboData.SCOPE);
        ssoHandler = new SsoHandler(this, authInfo);
        ssoHandler.authorize(this);

    } else if (v.getId() == R.id.github_btn) {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/sherlockchou86"));
        startActivity(browserIntent);
    }
}
 
开发者ID:sherlockchou86,项目名称:yphoto,代码行数:13,代码来源:SignInActivity.java

示例6: auth

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
@Override
public void auth(Activity activity) {
    ShareType = ShareConstant.AUTH;
    mAccessToken = new Oauth2AccessToken();
    mAuthInfo = new AuthInfo(activity, BuildConfig.SINA_APP_ID, REDIRECT_URL, null);
    mSsoHandler = new SsoHandler(activity, mAuthInfo);
    authWrap = new AuthWrap();

    authWrap.context = activity;
    authWrap.authListener = new AuthListener();
    mSsoHandler.authorize(authWrap.authListener);
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:13,代码来源:ShareSina.java

示例7: auth

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
public static void auth(Activity activity, SsoHandler mSsoHandler, OnAuthOverListener listener) {
        Oauth2AccessToken token = TokenStoreUtils.getWbToken(activity);
        if (token != null && token.isSessionValid()) {
            listener.onAuth(token);
        } else {
            // 创建微博实例
            // 快速授权时,请不要传入 SCOPE,否则可能会授权不成功
            LogUtils.e(TAG, "wb_auth", "开始授权");
            mSsoHandler.authorize(new MyWeiboAuthListener(activity, listener));
//            mSsoHandler.authorizeClientSso(new MyWeiboAuthListener(activity,listener));
        }
    }
 
开发者ID:chendongMarch,项目名称:SocialSdkLibrary,代码行数:13,代码来源:WbAuthHelper.java

示例8: onCreate

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mAuthInfo = new AuthInfo(this, ShareConstant.getIns().getWeiboAppid(), ShareConstant.getIns().getWeiboUrl(), ShareConstant.getIns().getWeiboScope());
    mSsoHandler = new SsoHandler(WeiBoAuthActivity.this, mAuthInfo);
    mAccessToken = AccessTokenKeeper.readAccessToken(this);
    if (mAccessToken.isSessionValid()) {
        //打开编辑界面
        startEditActivity();
    } else {
        mSsoHandler.authorize(new AuthListener());
    }
}
 
开发者ID:joy-inc,项目名称:joy-library,代码行数:14,代码来源:WeiBoAuthActivity.java

示例9: login

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
@Override
public void login(org.henjue.library.share.AuthListener authListener) {
    mAuthListener = authListener;
    AccessTokenKeeper.clear(mContext);
    mAuthInfo = new com.sina.weibo.sdk.auth.AuthInfo(mContext, mSinaAppKey, ShareSDK.getInstance().getSinaRedirectUrl(), SCOPE);
    mSsoHandler = new SsoHandler((Activity) mContext, mAuthInfo);
    mSsoHandler.authorize(new AuthListener());

}
 
开发者ID:henjue,项目名称:sharesdk,代码行数:10,代码来源:WeiboAuthManager.java

示例10: onCreate

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    boolean startByMyself = getIntent().getBooleanExtra(ARG_START_BY_MYSELF, false);
    if (!startByMyself) {
        finish();
        return;
    }

    jokeBean = (JokeBean) getIntent().getSerializableExtra(ARG_JOKE);

    Oauth2AccessToken accessToken = DataSharedPreferences.readAccessToken();
    if (accessToken.isSessionValid()) {
        share();
    } else {
        AuthInfo mAuthInfo = new AuthInfo(this, WEIBO_APP_KEY, WEIBO_REDIRECT_URL, WEIBO_SCOPE);
        mSsoHandler = new SsoHandler(this, mAuthInfo);
        mSsoHandler.authorize(new AuthListener());
    }

    finish();
}
 
开发者ID:CyanFlxy,项目名称:KnockKnock,代码行数:28,代码来源:WeiboAuthActivity.java

示例11: LoginSina

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
/**
 * 新浪授权登录
 */
private void LoginSina() {
    WeiboAuth  mAuthInfo = new WeiboAuth(this, Constants.Weibo_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
   mSsoHandler  = new SsoHandler(LoginActivity.this, mAuthInfo);
    mSsoHandler.authorize(new AuthListener());


}
 
开发者ID:hanks-zyh,项目名称:Conquer,代码行数:11,代码来源:LoginActivity.java

示例12: sinaOauth

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
/**
 * sina oauth
 */
public void sinaOauth(Activity activity) {
	 mWeiboAuth = new WeiboAuth(activity, Constants.APP_KEY, Constants.REDIRECT_URL, Constants.SCOPE);
	 mSsoHandler = new SsoHandler(activity, mWeiboAuth);
        mSsoHandler.authorize(new AuthListener(activity));
        needReInit = true;
}
 
开发者ID:simplelifetian,项目名称:GomeOnline,代码行数:10,代码来源:PlatformSina.java

示例13: login

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
public SsoHandler login(WeiboAuthListener listener) {
    AuthInfo authInfo = new AuthInfo(activity, appKey, "http://sns.whalecloud.com/sina2/callback", null);
    SsoHandler handler = new SsoHandler(activity, authInfo);
    handler.authorize(listener);
    return handler;
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:7,代码来源:OpenBuilder.java

示例14: handlerSSO

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
private void handlerSSO() {
	mSSOHandler = new SsoHandler(this, mAuthInfo);
	// 未安装微博情况下,需要调用web?
	mSSOHandler.authorize(mAuthListener);
}
 
开发者ID:Joy-Whale,项目名称:EasyShare,代码行数:6,代码来源:SinaWeiboEntryActivity.java

示例15: reAuthSina

import com.sina.weibo.sdk.auth.sso.SsoHandler; //导入方法依赖的package包/类
/**
 * 重新授权,授权结束后会检查uid是否跟之前的一致,不一致会返回失败
 */
private void reAuthSina() {
    AuthInfo mWeiboAuth = new AuthInfo(this, SinaWeibo_APPKEY,
            SinaWeibo_RedirectUrl, SinaWeibo_Scope);
    mSsoHandler = new SsoHandler(this, mWeiboAuth);
    mSsoHandler.authorize(new WeiboAuthListener() {
        @Override
        public void onWeiboException(WeiboException e) {
            Toast.makeText(LoginSinaWeiboActivity.this,
                    "授权出错 : " + e.getMessage(), Toast.LENGTH_LONG).show();
            LoginSinaWeiboActivity.this.finish();
        }

        @Override
        public void onComplete(Bundle values) {
            Oauth2AccessToken mAccessToken = Oauth2AccessToken
                    .parseAccessToken(values); // 从 Bundle 中解析 Token
            if (mAccessToken.isSessionValid()) {
                String token = mAccessToken.getToken();
                String expires_in = mAccessToken.getExpiresTime() + "";
                String uid = mAccessToken.getUid();
                // 检查新授权的uid是否跟之前的一致
                String oldUid = PreferenceManager.getString(
                        LoginSinaWeiboActivity.this,
                        PreferenceManager.KEY_WEIBO_SINA_WEIBO_UID, "");
                if (uid.equals(oldUid)) {
                    PreferenceManager.putString(
                            LoginSinaWeiboActivity.this,
                            PreferenceManager.KEY_WEIBO_SINA_TOKEN, token);
                    PreferenceManager
                            .putString(
                                    LoginSinaWeiboActivity.this,
                                    PreferenceManager.KEY_WEIBO_SINA_WEIBO_UID,
                                    uid);
                    PreferenceManager.putLong(LoginSinaWeiboActivity.this,
                            PreferenceManager.KEY_WEIBO_SINA_EXPIRES_IN,
                            Long.parseLong(expires_in));
                    if (callBack != null) {
                        callBack.onSuccess();
                    } else {
                        ActivityUtils.showCenterToast(LoginSinaWeiboActivity.this,
                                "重新授权成功", Toast.LENGTH_SHORT);
                    }
                } else {
                    if (callBack != null) {
                        callBack.onFaild(1001, "请使用原微博帐号进行重新授权");
                    } else {
                        ActivityUtils.showCenterToast(LoginSinaWeiboActivity.this,
                                "请使用原微博帐号进行重新授权", Toast.LENGTH_SHORT);
                    }
                }
                LoginSinaWeiboActivity.this.finish();
            } else {
                // 当您注册的应用程序签名不正确时,就会收到错误Code,请确保签名正确
                String code = values.getString("code");
                ActivityUtils.showCenterToast(LoginSinaWeiboActivity.this,
                        "授权完成时出现错误,错误码" + code, Toast.LENGTH_SHORT);
            }

        }

        @Override
        public void onCancel() {
            Toast.makeText(LoginSinaWeiboActivity.this, "授权取消",
                    Toast.LENGTH_LONG).show();
            LoginSinaWeiboActivity.this.finish();
        }
    });
}
 
开发者ID:fatsoon,项目名称:UniversalCommunityAccount,代码行数:72,代码来源:LoginSinaWeiboActivity.java


注:本文中的com.sina.weibo.sdk.auth.sso.SsoHandler.authorize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。