public ExactOnlineConnection(string clientId, string clientSecret, string redirectUri, string endPoint, IDropboxUserToken dropboxUserToken) { this.dropboxUserToken = dropboxUserToken; miscellaneousDocumentType = 55; generalCategory = Guid.Parse("3b6d3833-b31b-423d-bc3c-39c62b8f2b12"); //Guid.Parse(clientId); this.endPoint = endPoint; authorization = new AuthorizationState { Callback = new Uri(redirectUri) }; var token = dropboxUserToken.TryRetrieveTokenFromDatabase(HardcodedUser.Id); authorization.AccessToken = token.ExactAccessToken; authorization.AccessTokenExpirationUtc = token.ExactAccessTokenExpiration; exactClient = IsAccessTokenValid() ? new ExactOnlineClient(endPoint, GetAccessToken) : exactClient; var serverDescription = new AuthorizationServerDescription { AuthorizationEndpoint = new Uri(string.Format("{0}/api/oauth2/auth", endPoint)), TokenEndpoint = new Uri(string.Format("{0}/api/oauth2/token", endPoint)) }; oAuthClient = new UserAgentClient(serverDescription, clientId, clientSecret); oAuthClient.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(clientSecret); }
public DropboxApiConnection(string clientId, string clientSecret, string redirectUri, IDropboxUserToken dropboxUserToken) { this.dropboxUserToken = dropboxUserToken; var token = dropboxUserToken.TryRetrieveTokenFromDatabase(HardcodedUser.Id); accessToken = token.DropboxAccessToken; var options = new Options { ClientId = clientId, ClientSecret = clientSecret, RedirectUri = redirectUri, UseSandbox = true, AccessToken = accessToken }; dropboxClient = new Client(options); }