// GET: /Home/Connect public async Task <InstamgramClient> GetInstagramClient() { Oauth2Helper oauth2Helper = new Oauth2Helper() { ClientId = _clientId, Secret = _secret, RedirectUrl = _redirectUri, CodeEndPoint = _codeEndPoint, TokenEndPoint = _tokenRequestURI, SuccessUrl = _successUrl, SucessMsg = _msg }; var userCredential = await oauth2Helper.GetUserCredential(); InstamgramClient instamgramClient = new InstamgramClient(userCredential); return(instamgramClient); }
// GET: /Home/Connect public async Task <DropboxClient> GetDropboxClient() { DropboxClient dropboxClient = null; var authorizationRequest = DropboxOAuth2Helper.GetAuthorizeUri( OAuthResponseType.Code, clientId, RedirectUri).ToString(); Oauth2Helper oauth2Helper = new Oauth2Helper(); string code = await oauth2Helper.GetCode(authorizationRequest, RedirectUri, "www.google.com", "return to app!!!"); //获取code成功 if (!string.IsNullOrEmpty(code)) { string token = await AuthAsync(code); if (!string.IsNullOrEmpty(token)) { dropboxClient = new DropboxClient(token, new DropboxClientConfig("iMobieDriveDemo")); } } return(dropboxClient); }