You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Omri1984
3 years agoExplorer | Level 4
Access token not beeing refreshed automatically
my application support old dropbox and the new one. when creating the client i am creating it like this client = new DropboxTeamClient(request.AccessToken, request.RefreshToken,request.Expires,Cl...
Omri1984
Explorer | Level 4
ok, but if i am calling the first way
i am getting the error.
I am trying to understand.
after 4 hours i am creating the dropbox team client with all the correct data(access,refresh,secret etc..).
but getting an error
can you try and reproduce it .
create a new token with 4 hours.
then wait 4 hours and then call the new dropbox team client with the token then you get before and call the client.Team.MembersListAsync()
i even try to call the refresh token method manually but this didn't work also
need your help 🙂
Greg-DB
3 years agoDropbox Staff
Yes, I tried the code you shared, plugging in valid refresh token, etc. values, and it worked for me.
Please review the list in my previous message for reasons why that would fail for you. Check and update your values as necessary to make sure you're providing correct and valid refresh token, etc. credentials.
- Omri19843 years agoExplorer | Level 4
i an not understand and will need more assistance.
in my up i am always using the DropboxTeamClient creating it with all the necessary parameters
like this.
var client = new DropboxTeamClient(request.AccessToken, request.RefreshToken, request.Expires, ClientId, ClientSecret);
now after that i am checking if the client is in the new space or the old one
like this
var account = await client.AsMember(request.AsMember).Users.GetCurrentAccountAsync();
var spaceclient = client.AsMember(request.AsMember).WithPathRoot(new PathRoot.Root(account.RootInfo.RootNamespaceId));if (account.RootInfo.IsTeam)
{metadata = await spaceclient.Files.ListFolderAsync(folderId);
}
else
{
metadata = await client.AsMember(request.AsMember).Files.ListFolderAsync(folderId)
}now sometimes i need to call this
client.Team.MembersListAsync().ConfigureAwait(false);
and befoe every call i am calling the
var client = new DropboxTeamClient(request.AccessToken, request.RefreshToken, request.Expires, ClientId, ClientSecret);
and I need it because that sometimes i am handing for the same client al the data content and all the user and groups as well
and my issue is that after the token is expire i am getting the error that was in the first message .
400 error
i am really need to get to the bottom of this and understand is completely
Thank you
- Здравко3 years agoLegendary | Level 20
Hi Omri1984,
Can you just print (or display somehow) content of "request.RefreshToken"? Is there something that looks like valid refresh token or not exactly? 🧐
Hope this gives direction.
- Omri19843 years agoExplorer | Level 4
something like this
ZEaFs***lgUAAAAAAAAAARUCp-9WwOK************************PIUr3P72**********Eg
does it make sense ?
- Здравко3 years agoLegendary | Level 20
Omri1984 wrote:...
and befoe every call i am calling the
var client = new DropboxTeamClient(request.AccessToken, request.RefreshToken, request.Expires, ClientId, ClientSecret);
and I need it because that sometimes i am handing for the same client al the data content and all the user and groups as well
...
You don't need to do the above "before every call". Changing client representation is enough. Otherwise, you are slowing down your speed up to 2 times (on every regular API call one more refresh call). It's meaningless.
- Greg-DB3 years agoDropbox Staff
Omri1984 It sounds like there's an issue with the credentials you're supplying, so trying the call outside of the SDK as Здравко suggested should be a useful test.
- Omri19843 years agoExplorer | Level 4
I added some logs to check my cred during the running .
I will update here, it holiday now so in a few days ,
thanks for the help.
by the way.
if create a new DropboxTeamClient(request.AccessToken, request.RefreshToken,request.Expires,ClientId,ClientSecret);
can I call those methods
var account = await client.AsMember(request.AsMember).Users.GetCurrentAccountAsync();
var spaceclient = client.AsMember(request.AsMember).WithPathRoot(new PathRoot.Root(account.RootInfo.RootNamespaceId));
if (account.RootInfo.IsTeam)
{
await spaceclient.Files.ListFolderAsync(folderId)}
await client.Team.MembersListAsync()
await client.AsMember(request.AsMember).Files.ListFolderAsync(folderId)
and another question ,When using the .Net SDK when is the refresh token is happening?
does it happen for every method ?
does it happen when creating the client (new DropboxTeamClient(request.AccessToken, request.RefreshToken,request.Expires,ClientId,ClientSecret);)
Thank you
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,912 PostsLatest Activity: 3 hours 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!