com.sina.weibo.sdk.auth.AuthInfo Java Examples
The following examples show how to use
com.sina.weibo.sdk.auth.AuthInfo.
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: 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 #2
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 #3
Source File: BaseLoginShare.java From LoginSharePay with Apache License 2.0 | 5 votes |
@Override public void launchWeiboLogin() { WbSdk.install(proxyFragment.getContext(), new AuthInfo(proxyFragment.getContext(), weiboValue, weiboRedirectUrl, weiboScope)); if (ssoHandler == null) { ssoHandler = new SsoHandler(proxyFragment); } }
Example #4
Source File: WBHelper.java From SocialHelper with Apache License 2.0 | 5 votes |
WBHelper(Activity activity, String appId, String redirectUrl) { this.activity = activity; this.appId = appId; this.redirectUrl = redirectUrl; if (TextUtils.isEmpty(appId) || TextUtils.isEmpty(redirectUrl)) { Log.w("WBHelper", "WeBo's appId or redirectUrl is empty!"); return; } WbSdk.install(activity.getApplicationContext(), new AuthInfo(activity.getApplicationContext(), appId, redirectUrl, SCOPE)); }
Example #5
Source File: AuthRequestParam.java From letv with Apache License 2.0 | 5 votes |
protected void onSetupRequestParam(Bundle data) { Bundle authInfoBundle = data.getBundle(EXTRA_KEY_AUTHINFO); if (authInfoBundle != null) { this.mAuthInfo = AuthInfo.parseBundleData(this.mContext, authInfoBundle); } this.mAuthListenerKey = data.getString(EXTRA_KEY_LISTENER); if (!TextUtils.isEmpty(this.mAuthListenerKey)) { this.mAuthListener = WeiboCallbackManager.getInstance(this.mContext).getWeiboAuthListener(this.mAuthListenerKey); } }
Example #6
Source File: WeiboSdkBrowser.java From letv with Apache License 2.0 | 5 votes |
public static void startAuth(Context context, String url, AuthInfo authInfo, WeiboAuthListener listener) { AuthRequestParam reqParam = new AuthRequestParam(context); reqParam.setLauncher(BrowserLauncher.AUTH); reqParam.setUrl(url); reqParam.setAuthInfo(authInfo); reqParam.setAuthListener(listener); Intent intent = new Intent(context, WeiboSdkBrowser.class); intent.putExtras(reqParam.createRequestParamBundle()); context.startActivity(intent); }
Example #7
Source File: SsoHandler.java From letv with Apache License 2.0 | 5 votes |
public SsoHandler(Activity activity, AuthInfo weiboAuthInfo) { this.mAuthActivity = activity; this.mAuthInfo = weiboAuthInfo; this.mWebAuthHandler = new WebAuthHandler(activity, weiboAuthInfo); this.mWeiboInfo = WeiboAppManager.getInstance(activity).getWeiboInfo(); AidTask.getInstance(this.mAuthActivity).aidTaskInit(weiboAuthInfo.getAppKey()); }
Example #8
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 #9
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 #10
Source File: SinaWBHandler.java From SocialSDKAndroid with Apache License 2.0 | 5 votes |
@Override public void onCreate(Context context, PlatformConfig.Platform config) { this.mContext = context; this.mConfig = (PlatformConfig.SinaWB) config; this.mAuthInfo = new AuthInfo(mContext, mConfig.appKey, REDIRECT_URL, SCOPE); this.mWeiboShareAPI = WeiboShareSDK.createWeiboAPI(context, mConfig.appKey); this.mWeiboShareAPI.registerApp(); }
Example #11
Source File: WeiboShareManager.java From sharesdk with Apache License 2.0 | 5 votes |
WeiboShareManager(Context context) { Application app = (Application) context.getApplicationContext(); app.registerActivityLifecycleCallbacks(this); mContext = context; mSinaAppKey = ShareSDK.getInstance().getWeiboAppId(); mSinaRedirectUrl = ShareSDK.getInstance().getSinaRedirectUrl(); mSinaScope = ShareSDK.getInstance().getWeiboScope(); if (!TextUtils.isEmpty(mSinaAppKey)) { // 创建微博 SDK 接口实例 AuthInfo mAuthInfo = new AuthInfo(context, mSinaAppKey, mSinaRedirectUrl, mSinaScope); WbSdk.install(context, mAuthInfo); } }
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: WBShare.java From sdk3rd with Apache License 2.0 | 5 votes |
WBShare(Activity activity, Platform platform) { WbSdk.install(activity, new AuthInfo(activity, platform.getAppId(), platform.extra("redirectUrl"), "all")); mActivity = activity; mPlatform = platform; mApi = new WbShareHandler(mActivity); mApi.registerApp(); services.put(this, true); }
Example #14
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 #15
Source File: SharePopWindow.java From QiQuYing with Apache License 2.0 | 5 votes |
private void share2weibo() { setShareContent(); // 1. 初始化微博的分享消息 WeiboMultiMessage weiboMessage = new WeiboMultiMessage(); weiboMessage.mediaObject = getWebpageObj(); weiboMessage.textObject = getTextObj(); //这里可以设置文本 if(mJoke.getType() != Joke.TYPE_QUSHI) { weiboMessage.imageObject = getImageObj(); } // 2. 初始化从第三方到微博的消息请求 SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest(); // 用transaction唯一标识一个请求 request.transaction = String.valueOf(System.currentTimeMillis()); request.multiMessage = weiboMessage; AuthInfo authInfo = new AuthInfo(context, com.sina.weibo.Constants.APP_KEY, com.sina.weibo.Constants.REDIRECT_URL, com.sina.weibo.Constants.SCOPE); Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context); String token = ""; if (accessToken != null) { token = accessToken.getToken(); } mWeiboShareAPI.sendRequest((Activity)context, request, authInfo, token, new WeiboAuthListener() { @Override public void onWeiboException( WeiboException arg0 ) { Log.e(TAG, "share sina weibo error", arg0); ToastUtils.showMessage(context, "分享失败"); } @Override public void onComplete( Bundle bundle ) { Oauth2AccessToken newToken = Oauth2AccessToken.parseAccessToken(bundle); AccessTokenKeeper.writeAccessToken(context, newToken); ImgToastUtils.showMessage(context, "分享成功", R.drawable.center_ok_tip); } @Override public void onCancel() { } }); }
Example #16
Source File: WeiboBaseShareInstance.java From SimpleProject with MIT License | 5 votes |
public WeiboBaseShareInstance(Activity activity, ShareListener listener) { this.activity = activity; this.listener = listener; ImageLoaderManager.getInstance().init(activity.getApplicationContext(), new FrescoInstance()); AuthInfo authInfo = new AuthInfo(activity, ShareConstants.APP_WEIBO_KEY, ShareConstants.REDIRECT_URL, ShareConstants.SCOPE); WbSdk.install(activity, authInfo); shareHandler = new WbShareHandler(activity); shareHandler.registerApp(); accessToken = AccessTokenKeeper.readAccessToken(activity); }
Example #17
Source File: WeiboShareProxy.java From ESSocialSDK with Apache License 2.0 | 5 votes |
private static void shareTo(final Context context, final String appKey, final String redirectUrl, final String scop, final String title, final String desc, final String imageUrl, final String shareUrl, final WeiboAuthListener listener) { new Thread(new Runnable() { @Override public void run() { WeiboMultiMessage msg = new WeiboMultiMessage(); TextObject text = new TextObject(); text.text = desc; msg.textObject = text; WebpageObject web = new WebpageObject(); web.description = desc; byte[] thumb = SocialUtils.getHtmlByteArray(imageUrl); if (null != thumb) web.thumbData = SocialUtils.compressBitmap(thumb, 32); else web.thumbData = SocialUtils.compressBitmap(SocialUtils.getDefaultShareImage(context), 32); web.actionUrl = shareUrl; web.identify = imageUrl; web.title = title; msg.mediaObject = web; SendMultiMessageToWeiboRequest request = new SendMultiMessageToWeiboRequest(); request.transaction = String.valueOf(System.currentTimeMillis()); request.multiMessage = msg; AuthInfo authInfo = new AuthInfo(context, appKey, redirectUrl, scop); Oauth2AccessToken accessToken = AccessTokenKeeper.readAccessToken(context); String token = ""; if (accessToken != null) { token = accessToken.getToken(); } getInstance(context, appKey).sendRequest((Activity) context, request, authInfo, token, listener); } }).start(); }
Example #18
Source File: AuthRequestParam.java From letv with Apache License 2.0 | 4 votes |
public AuthInfo getAuthInfo() { return this.mAuthInfo; }
Example #19
Source File: Share.java From UPMiss with GNU General Public License v3.0 | 4 votes |
public static void init(Context context) { // 微博初始化 AuthInfo mAuthInfo = new AuthInfo(context, Constants.WB_APP_ID, Constants.WB_REDIRECT_URL, Constants.WB_SCOPE); WbSdk.install(context, mAuthInfo); }
Example #20
Source File: WbPlatform.java From SocialSdkLibrary with Apache License 2.0 | 4 votes |
private WbPlatform(Context context, String appId, String appName, int target, String redirectUrl, String scope) { super(context, appId, appName, target); AuthInfo authInfo = new AuthInfo(context, appId, redirectUrl, scope); WbSdk.install(context, authInfo); }
Example #21
Source File: BaseHandler.java From LoginSharePay with Apache License 2.0 | 4 votes |
protected void startWebAuth() { AuthInfo authInfo = WbSdk.getAuthInfo(); WeiboParameters requestParams = new WeiboParameters(authInfo.getAppKey()); requestParams.put("client_id", authInfo.getAppKey()); requestParams.put("redirect_uri", authInfo.getRedirectUrl()); requestParams.put("scope", authInfo.getScope()); requestParams.put("response_type", "code"); requestParams.put("version", "0041005000"); requestParams.put("luicode", "10000360"); Oauth2AccessToken token = AccessTokenKeeper.readAccessToken(this.mAuthFragment.getContext()); if (token != null && !TextUtils.isEmpty(token.getToken())) { requestParams.put("trans_token", token.getToken()); requestParams.put("trans_access_token", token.getToken()); } requestParams.put("lfid", "OP_" + authInfo.getAppKey()); String aid = Utility.getAid(this.mAuthFragment.getContext(), authInfo.getAppKey()); if (!TextUtils.isEmpty(aid)) { requestParams.put("aid", aid); } requestParams.put("packagename", authInfo.getPackageName()); requestParams.put("key_hash", authInfo.getKeyHash()); String url = "https://open.weibo.cn/oauth2/authorize?" + requestParams.encodeUrl(); if (!NetworkHelper.hasInternetPermission(this.mAuthFragment.getContext())) { UIUtils.showAlert(this.mAuthFragment.getContext(), "Error", "Application requires permission to access the Internet"); } else { String mAuthListenerKey = null; if (this.authListener != null) { WeiboCallbackManager manager = WeiboCallbackManager.getInstance(); mAuthListenerKey = manager.genCallbackKey(); manager.setWeiboAuthListener(mAuthListenerKey, this.authListener); } AuthWebViewRequestParam param = new AuthWebViewRequestParam(authInfo, WebRequestType.AUTH, mAuthListenerKey, "微博登录", url, this.mAuthFragment.getContext()); Intent intent = new Intent(this.mAuthFragment.getContext(), WeiboSdkWebActivity.class); Bundle bundle = new Bundle(); param.fillBundle(bundle); intent.putExtras(bundle); this.mAuthFragment.startActivity(intent); } }
Example #22
Source File: BaseLoginShare.java From LoginSharePay with Apache License 2.0 | 4 votes |
@Override public void launchWeiboShare(WeiboMessageBody weiboMessageBody) { WbSdk.install(proxyFragment.getContext(), new AuthInfo(proxyFragment.getContext(), weiboValue, weiboRedirectUrl, weiboScope)); shareHandler = new WbShareHandler(proxyFragment.getContext()); shareHandler.registerApp(); }
Example #23
Source File: AuthRequestParam.java From letv with Apache License 2.0 | 4 votes |
public void setAuthInfo(AuthInfo mAuthInfo) { this.mAuthInfo = mAuthInfo; }
Example #24
Source File: WeiboShareInstance.java From ShareLoginPayUtil with Apache License 2.0 | 4 votes |
public WeiboShareInstance(Context context, String appId, String redirectUrl, String scope) { AuthInfo authInfo = new AuthInfo(context, appId, redirectUrl, scope); WbSdk.install(context, authInfo); shareHandler = new WbShareHandler((Activity) context); shareHandler.registerApp(); }
Example #25
Source File: WeiboSdkBrowser.java From letv with Apache License 2.0 | 4 votes |
public static void startShared(Context context, String url, AuthInfo authInfo, WeiboAuthListener listener) { }
Example #26
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 #27
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); }
Example #28
Source File: LoginoutButton.java From Simpler with Apache License 2.0 | 2 votes |
/** * 设置微博授权所需信息以及回调函数。 * * @param authInfo 用于保存授权认证所需要的信息 * @param authListener 微博授权认证回调接口 */ public void setWeiboAuthInfo(AuthInfo authInfo, WeiboAuthListener authListener) { mAuthInfo = authInfo; mAuthListener = authListener; }
Example #29
Source File: LoginoutButton.java From Simpler with Apache License 2.0 | 2 votes |
/** * 设置微博授权所需信息。 * * @param appKey 第三方应用的 APP_KEY * @param redirectUrl 第三方应用的回调页 * @param scope 第三方应用申请的权限 * @param authListener 微博授权认证回调接口 */ public void setWeiboAuthInfo(String appKey, String redirectUrl, String scope, WeiboAuthListener authListener) { mAuthInfo = new AuthInfo(mContext, appKey, redirectUrl, scope); mAuthListener = authListener; }
Example #30
Source File: LoginButton.java From Simpler with Apache License 2.0 | 2 votes |
/** * 设置微博授权所需信息以及回调函数。 * * @param authInfo 用于保存授权认证所需要的信息 * @param authListener 微博授权认证回调接口 */ public void setWeiboAuthInfo(AuthInfo authInfo, WeiboAuthListener authListener) { mAuthInfo = authInfo; mAuthListener = authListener; }