We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
dbapiadmin
3 years agoHelpful | Level 5
BackEnd Process with C#
I have a back-end process (without UI) that uses the dropboxteamclient and I have to do a number of reporting, file management in team folders. However, the current API is to use everything with HTTP redirect to get an accesstoken. How do we do this with a back-end process? I'm currently really stuck because I'm getting short lived tokens from the Developer page using "Generate Token". There has to be a better way for backend processes?
using (var teamClient = new DropboxTeamClient(token))
{
var memberList = teamClient.Team.MembersListAsync().Result;
foreach (var member in memberList.Members)
{
if(member.Profile.Email == "email@mycomany.com")
{
memId = member.Profile.TeamMemberId;
}
}
var dbx = teamClient.AsMember(memId);
var accountInfo = dbx.Users.GetCurrentAccountAsync();
dbx = dbx.WithPathRoot(new PathRoot.NamespaceId("xxxxxxx")); // To get Folders
}
It's working I changed the sample code to
var http = new HttpListener();
http.Prefixes.Add("http://*:port/");
- Greg-DBDropbox Staff
Dropbox is in the process of switching to only issuing short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens. You can find more information on this migration here.
Apps can still get long-term access by requesting "offline" access though, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation.
It is not possible to fully automate the OAuth process where the user chooses to authorize the app and the app then receives the resulting access token and optional refresh token. This needs to be done manually by the user at least once. If your app needs to maintain long-term access without the user manually re-authorizing it repeatedly, the app should request "offline" access so that it gets a refresh token. The refresh token doesn't expire and can be stored and used repeatedly to get new short-lived access tokens whenever needed, without the user manually reauthorizing the app.
You can find an example of processing the app authorization flow and getting and using a refresh token in the OauthBasic example (non-PKCE, meant for server-side apps) as well as in the OAuthPKCE example (PKCE, meant for client-side apps). The SDK will handle the refresh process for you automatically as long as you supply the credentials as shown in the examples.
For reference, while the creation of new long-lived access tokens is now deprecated, we don't currently have a plan to disable existing long-lived access tokens. (If that changes, we will of course announce that ahead of time.) That being the case, you can continue using existing long-lived access token(s) without interruption, if you have any. Also, note though that after the change you won't be able to create new long-lived access tokens.
While the change began on September 30th 2021, we're releasing it gradually, so you may not have seen your app(s) affected until now. Once it applies to your app, it would apply regardless of the "Access token expiration" setting for your app, and that setting may no longer be available for your app.
- dbapiadminHelpful | Level 5
I have tried the OAuth Basic flow but it seems that opens a local window and we have to authorize again. Is there something we can do so we don't have to open a browser window? This is an unattended server side application.
- Greg-DBDropbox Staff
You only need to do the authorization flow in the browser once per user. You can then store and re-use the resulting refresh token without further manual action. Refresh tokens can be re-used repeatedly and don't expire automatically.
About Discuss Dropbox Developer & API
Make connections with other developers
795 PostsLatest Activity: 5 days agoIf 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!