We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

chrish7's avatar
chrish7
New member | Level 2
4 years ago

expired_access_token in .NET API

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).

 

  

 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox 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's avatar
    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's avatar
      kylea
      Icon for Dropbox Staff rankDropbox 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?

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!