cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: expired_access_token in .NET API

expired_access_token in .NET API

chrish7
New member | Level 2

I'm using the .NET Api with refresh tokens.

 

I get the authorization uri and the user gives permission.

 

var authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Code, ApiKey, RedirectUri, state: state, tokenAccessType : TokenAccessType.Offline, scopeList : scopeList, includeGrantedScopes: IncludeGrantedScopes.None);

I then get the token. The response does include a refresh token.

var tokenResult = await DropboxOAuth2Helper.ProcessCodeFlowAsync(redirectUri, ApiKey, ApiSecret, RedirectUri.ToString(), state);

I initialize the DropboxClient class with the refresh token.

var client = new DropboxClient(this.UserSettings.AccessToken, this.UserSettings.RefreshToken, ApiKey, ApiSecret, config);

This worked initially however I now get an "expired_access_token" result from the API. Does the client use the refresh token automatically or do I need to handle this and manually refresh the access token?

 

(I'm using version 5.5.0 of the .NET Dropbox AP).

 

  

 

3 Replies 3

Greg-DB
Dropbox Staff

The SDK should handle the refresh for you automatically. Can you double check that you have the correct access token, refresh token, app key, and app secret values though? For instance, you need to use the same app key and app secret you used to originally get the refresh token in order to use the refresh token to get a new access token.

Ellen Y
New member | Level 2

I have the same issue, and I can ensure the access token and refresh token are the correct value.

kylea
Dropbox Staff

@Ellen Y the SDK should cover this case.  Can you confirm the version of the SDK you are working with, and share code snippets that demonstrate the issue?

Need more support?