public override async Task Login(ZhiHuLoginInfo info, Action <RiBaoAuthoInfo> loginCallback) { if (IsAuthorized && TokenInfo != null) { var zhiHuAuthoData = await LoginZhiHu(); loginCallback?.Invoke(zhiHuAuthoData); return; } try { _oauth.LoginCallback += async(isSuccess, err, response) => { if (isSuccess) { _oauth.IsAuthorized = true; UpdateTokenInfo(response); var zhiHuAuthoData = await LoginZhiHu(); loginCallback?.Invoke(zhiHuAuthoData); } else { loginCallback?.Invoke(null); } }; _oauth.BeginOAuth(); } catch { loginCallback?.Invoke(null); } }
/// <summary> /// Go to authorize /// </summary> protected void Authorize() { BaseModel baseParameter = XmlUtility.Instance.GetAppSettingByKey(); if (null != baseParameter) { SdkData.AppKey = baseParameter.AppKey; SdkData.AppSecret = baseParameter.AppSecret; SdkData.RedirectUri = baseParameter.RedirectUri; } // prepare the pic to be shared. //CopyToIso("Assets/weibo.png", "weibo"); //Judge the authorization is expired whether or not. if (oauthClient.IsAuthorized == false) { oauthClient.LoginCallback += (isSuccess, err, response) => { if (isSuccess) { IsLoginSuccess = true; } else { IsLoginSuccess = false; } }; } else { IsLoginSuccess = true; } oauthClient.BeginOAuth(); }
private async void weibo_login() { await Task.Delay(1000); var Weibo_oauthClient = new ClientOAuth(); Weibo_oauthClient.BeginOAuth(); }
public void Login(Action <bool, object> loginCallback) { _oauth.LoginCallback += (isSuccess, err, response) => { if (isSuccess) { UpdateLoginData(response); } if (loginCallback != null) { loginCallback(isSuccess, response); } }; _oauth.BeginOAuth(); }