com.sina.weibo.sdk.auth.sso.SsoHandler Java Examples
The following examples show how to use
com.sina.weibo.sdk.auth.sso.SsoHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SinaShareHandler.java From BiliShare with Apache License 2.0 | 6 votes |
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); } }); } }
Example #2
Source File: ThirdPartLoginLayout.java From letv with Apache License 2.0 | 6 votes |
private void sinaLoginClick() { LetvLogApiTool.getInstance().saveExceptionInfo("sina登录开始 Current Time :" + StringUtils.getTimeStamp()); if (NetworkUtils.isNetworkAvailable()) { LogInfo.LogStatistics("新浪微博注册"); String pageId = this.mIsLoginPage ? PageIdConstant.loginPage : PageIdConstant.registerPage; StatisticsUtils.statisticsActionInfo(this.mActivity, pageId, "0", this.mIsLoginPage ? "c72" : "c82", null, 2, "ref=" + pageId + "_072_2"); if (SinaWeiboUtils.isWeiboAppSupportAPI(this.mActivity, "3830215581", false)) { this.mWeiboAuth = new AuthInfo(this.mActivity, "3830215581", "http://m.letv.com", "email,direct_messages_read,direct_messages_write,friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog,invitation_write"); this.mSsoHandler = new SsoHandler(this.mActivity, this.mWeiboAuth); this.mSsoHandler.authorize(new AuthListener(this)); return; } LetvOpenIDOAuthLoginActivity.launch(this.mActivity, ShareUtils.getSinaLoginUrl(), getResources().getString(2131100352)); return; } ToastUtils.showToast(2131101012); }
Example #3
Source File: WBLoginActivity.java From Simpler with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_wb_login); ButterKnife.bind(this); if (BaseConfig.sAddAccountMode) { mTvMsg.setText(R.string.add_another_account); } else { mTvMsg.setText(R.string.has_not_logined); } // 快速授权时,请不要传入 SCOPE,否则可能会授权不成功 // 高级授权 mAuthInfo = new AuthInfo(this, SinaConsts.WEICO_APP_KEY, SinaConsts.WEICO_REDIRECT_URL, SinaConsts.SCOPE, SinaConsts.WEICO_PACKAGE_NAME); // 普通授权 // mAuthInfo = new AuthInfo(this, SinaConsts.APP_KEY, SinaConsts.REDIRECT_URL, // SinaConsts.SCOPE, App.getInstance().getPackageName()); mSsoHandler = new SsoHandler(this, mAuthInfo); }
Example #4
Source File: WeiboBaseShareInstance.java From SimpleProject with MIT License | 5 votes |
@Override public void onShare(final String title, final String desc, final String iconUrl, final String url) { if (accessToken == null || !accessToken.isSessionValid()) { ssoHandler = new SsoHandler(activity); ssoHandler.authorize(new AuthListener(title, desc, iconUrl, url)); return; } if (!TextUtils.isEmpty(iconUrl)) { ImageLoaderManager.getInstance().downloadImage(activity, iconUrl, new ImageLoaderListener() { @Override public void onStart() { } @Override public void onProcess(int i, int i1) { } @Override public void onCompleted(Bitmap bitmap) { shareMediaByWeibo(activity, desc, url, bitmap); } @Override public void onFailure(Exception e) { shareMediaByWeibo(activity, desc, url, BitmapUtil.drawableToBitmap(activity.getResources().getDrawable(R.drawable.ic_launcher))); } }); } else { shareMediaByWeibo(activity, desc, url, BitmapUtil.drawableToBitmap(activity.getResources().getDrawable(R.drawable.ic_launcher))); } }
Example #5
Source File: LoginActivity.java From Conquer with Apache License 2.0 | 5 votes |
/** * 新浪授权登录 */ 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()); }
Example #6
Source File: WeiboAuthManager.java From sharesdk with Apache License 2.0 | 5 votes |
@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); mSsoHandler.authorize(new AuthListener()); }
Example #7
Source File: SinaShareImpl.java From ChinaShare with MIT License | 5 votes |
public SinaShareImpl(Activity activity, int resIcon, String title) { super(activity, resIcon, title); mAuthInfo = new AuthInfo(mActivity, ShareManager.getWeiboAppId(), ShareManager.getSinaRedirectUrl(), ShareManager.getScope()); mSsoHandler = new SsoHandler(mActivity, mAuthInfo); // 创建微博分享接口实例 mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(mActivity, ShareManager.getWeiboAppId()); mWeiboShareAPI.registerApp(); mAccessToken = AccessTokenKeeper.readAccessToken(mActivity); }
Example #8
Source File: WeiboLoginInstance.java From smart-farmer-android with Apache License 2.0 | 5 votes |
public WeiboLoginInstance(Activity activity, LoginListener listener, boolean fetchUserInfo) { super(activity, listener, fetchUserInfo); AuthInfo authInfo = new AuthInfo(activity, ShareManager.CONFIG.getWeiboId(), ShareManager.CONFIG.getWeiboRedirectUrl(), ShareManager.CONFIG.getWeiboScope()); mSsoHandler = new SsoHandler(activity, authInfo); mLoginListener = listener; }
Example #9
Source File: WeiboLoginInstance.java From ShareUtil with Apache License 2.0 | 5 votes |
public WeiboLoginInstance(Activity activity, LoginListener listener, boolean fetchUserInfo) { super(activity, listener, fetchUserInfo); AuthInfo authInfo = new AuthInfo(activity, ShareManager.CONFIG.getWeiboId(), ShareManager.CONFIG.getWeiboRedirectUrl(), ShareManager.CONFIG.getWeiboScope()); mSsoHandler = new SsoHandler(activity, authInfo); mLoginListener = listener; }
Example #10
Source File: WBHelper.java From SocialHelper with Apache License 2.0 | 5 votes |
/** * 1、登录 */ @Override public void login(SocialLoginCallback callback) { this.loginCallback = callback; if (baseVerify(callback)) { return; } initLoginListener(); mSsoHandler = new SsoHandler(activity); mSsoHandler.authorize(wbAuthCallback); }
Example #11
Source File: LetvSinaShareSSO.java From letv with Apache License 2.0 | 5 votes |
public static SsoHandler login(Activity context, String appName, String title, String content, String imgUrl, String playUrl, String from, int mode, String staticsId, String fragId) { if (isLogin(context) == 1 || isLogin2(context)) { SharePageEditActivity.launch((Context) context, 1, content, playUrl, "", mode, staticsId, fragId); if (context != null) { context.finish(); } return null; } SsoHandler mSsoHandler = new SsoHandler(context, new AuthInfo(context, "3830215581", "http://m.letv.com", "email,direct_messages_read,direct_messages_write,friendships_groups_read,friendships_groups_write,statuses_to_me_read,follow_app_official_microblog,invitation_write")); mSsoHandler.authorize(new 5(context, content, playUrl, mode, staticsId, fragId)); return mSsoHandler; }
Example #12
Source File: BaseDialog.java From AssistantBySDK with Apache License 2.0 | 5 votes |
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()); } }
Example #13
Source File: WBAuth.java From sdk3rd with Apache License 2.0 | 5 votes |
WBAuth(Activity activity, Platform platform) { WbSdk.install(activity, new AuthInfo(activity, platform.getAppId(), platform.extra("redirectUrl"), "all")); mActivity = activity; mPlatform = platform; mApi = new SsoHandler(mActivity); }
Example #14
Source File: WbLoginHelper.java From SocialSdkLibrary with Apache License 2.0 | 4 votes |
WbLoginHelper(Activity context) { this.mSsoHandler = new SsoHandler(context); this.mLoginTarget = Target.LOGIN_WB; }
Example #15
Source File: BaseDialog.java From AssistantBySDK with Apache License 2.0 | 4 votes |
public SsoHandler getmSsoHandler() { return mSsoHandler; }
Example #16
Source File: SinaWBHandler.java From SocialSDKAndroid with Apache License 2.0 | 4 votes |
@Override public void share(Activity activity, IShareMedia shareMedia, ShareListener shareListener) { this.mActivity = activity; this.mShareListener = shareListener; this.mSsoHandler = new SsoHandler(mActivity, mAuthInfo); WeiboMultiMessage weiboMessage = new WeiboMultiMessage(); if(shareMedia instanceof ShareTextImageMedia) { //文字图片分享 ShareTextImageMedia shareTextImageMedia = (ShareTextImageMedia) shareMedia; if(shareTextImageMedia.getText().length() > 0) { TextObject textObject = new TextObject(); textObject.text = shareTextImageMedia.getText(); weiboMessage.textObject = textObject; } if(shareTextImageMedia.getImage() != null) { ImageObject imageObject = new ImageObject(); imageObject.setImageObject(shareTextImageMedia.getImage()); weiboMessage.imageObject = imageObject; } } else { if(this.mShareListener != null) { this.mShareListener.onError(this.mConfig.getName(), "weibo is not support this shareMedia"); } return ; } SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest(); request.transaction = String.valueOf(System.currentTimeMillis()); request.multiMessage = weiboMessage; Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(mContext.getApplicationContext()); String token = ""; if (accessToken != null) { token = accessToken.getToken(); } mWeiboShareAPI.sendRequest(mActivity, request, mAuthInfo, token, new WeiboAuthListener() { @Override public void onWeiboException( WeiboException arg0 ) { } @Override public void onComplete( Bundle bundle ) { // TODO Auto-generated method stub Oauth2AccessToken newToken = Oauth2AccessToken.parseAccessToken(bundle); AccessTokenKeeper.writeAccessToken(mContext.getApplicationContext(), newToken); } @Override public void onCancel() { } }); // mWeiboShareAPI.sendRequest(mActivity, request); }
Example #17
Source File: WeiboAuthManager.java From sharesdk with Apache License 2.0 | 4 votes |
public static SsoHandler getSsoHandler() { return mSsoHandler; }
Example #18
Source File: WBLoginInstance.java From SimpleProject with MIT License | 4 votes |
public WBLoginInstance(Activity activity, String appKey, String redirectUrl, String scope, AuthListener listener) { this.listener = listener; AuthInfo authInfo = new AuthInfo(activity, appKey, redirectUrl, scope); WbSdk.install(activity, authInfo); ssoHandler = new SsoHandler(activity); }
Example #19
Source File: WeiboLoginInstance.java From ShareLoginPayUtil with Apache License 2.0 | 4 votes |
public WeiboLoginInstance(Activity activity, LoginListener listener, String appId, String redirectUrl, String scope, boolean fetchUserInfo) { super(activity, listener, fetchUserInfo); AuthInfo authInfo = new AuthInfo(activity, appId, redirectUrl, scope); WbSdk.install(activity, authInfo); mSsoHandler = new SsoHandler(activity); }