Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
CTO1
4 years agoExplorer | Level 3
Using Refresh Token
Currently I am trying to migrate our application to the new refresh token system
I am getting my Refresh token and my ExpiresAt values, and saving that data on the database,
if the ExpiresAt ...
CTO1
4 years agoExplorer | Level 3
here is where I am getting my model, the dbxService is where I send the refreshToken value as show in the previus message
public async Task<FileManagerViewModel> GetDropboxViewModel(Panther.Views.Attachment.IndexViewModel gridViewModel, IIdentityService identityService)
{
var dbxViewModel = new FileManagerViewModel();
dbxViewModel.Type = FileManagerProviderType.Dropbox;
Project project = null;
var dropBoxsettings = await _unitOfWork.DropBoxSettingsRepository.GetSettingsByTenantId(identityService.Tenant.Id).FirstAsync().ConfigureAwait(false);
var path = "/MyCompany";
MyCompanyLogger.Log(MyCompanyLogLevel.Info, "BlobRepository: GetDropboxViewModel", $"GridViewModel: {Newtonsoft.Json.JsonConvert.SerializeObject(gridViewModel)}");
try
{
var dbxService = new Panther.Services.DropboxService(dropBoxsettings);
FolderMetadata folder = null;
if (gridViewModel.AccountGuid.HasValue)
{
var account = await _unitOfWork.AccountRepository.GetAccount(identityService, gridViewModel.AccountGuid.Value, AccessLevelAction.Details).FirstAsync().ConfigureAwait(false);
folder = await dbxService.GetFolder(account.DropboxFolderId, account.NameAndNumber);
if (account.DropboxFolderId != folder.Id)
{
account.DropboxFolderId = folder.Id;
await _unitOfWork.AccountRepository.InsertOrUpdateAndSaveAsync(account).ConfigureAwait(false);
MyCompanyLogger.Log(MyCompanyLogLevel.Info, "BlobRepository: GetDropboxViewModel", $"Account updated Dropbox folder Id: {account.DropboxFolderId}");
}
path = folder.PathLower;
}
if (gridViewModel.ProjectGuid.HasValue)
{
project = await _unitOfWork.ProjectRepository.GetProject(identityService, gridViewModel.ProjectGuid.Value, AccessLevelAction.Details).FirstAsync().ConfigureAwait(false);
folder = await dbxService.GetFolder(project.DropboxFolderId, project.NameAndNumber, project.Account.DropboxFolderId, project.Account.NameAndNumber);
if (project.DropboxFolderId != folder.Id)
{
project.DropboxFolderId = folder.Id;
await _unitOfWork.ProjectRepository.InsertOrUpdateAndSaveAsync(project).ConfigureAwait(false);
MyCompanyLogger.Log(MyCompanyLogLevel.Info, "BlobRepository: GetDropboxViewModel", $"Project updated Dropbox folder Id: {project.DropboxFolderId}");
}
path = folder.PathLower;
}
var provider = new DropboxFileSystemProvider(path);
DevExpress.Web.AccountManager.RegisterDropbox("Dropbox1", "AccessTokenValue1");
provider.AccessTokenValue = Backoffice.Encryptor.Decrypt(dropBoxsettings.AuthToken);
provider.AccountName = Backoffice.Encryptor.Decrypt(dropBoxsettings.AuthToken);
dbxViewModel.FileSystemProvider = provider;
dbxViewModel.IsAllowCreate = HasAccess(FilePermissions.Create, identityService, project);
dbxViewModel.IsAllowDelete = HasAccess(FilePermissions.Delete, identityService);
dbxViewModel.IsAllowEdit = HasAccess(FilePermissions.Delete, identityService);
dbxViewModel.IsAllowDownload = HasAccess(FilePermissions.Download, identityService);
}
catch (Exception ex)
{
Backoffice.ErrorHelper.LogErrorManually(ex);
MyCompanyLogger.Log(MyCompanyLogLevel.Error, "BlobRepository: GetDropboxViewModel exception", ex);
}
return dbxViewModel;
}but here
provider.AccessTokenValue = Backoffice.Encryptor.Decrypt(dropBoxsettings.AuthToken);
I ma getting a message that says that AccessTokenValue is obsolete, I am unable to find any example of how to use:
can you tell me where is wrong the code please?
Здравко
4 years agoLegendary | Level 20
CTO1 wrote:...
provider.AccessTokenValue = Backoffice.Encryptor.Decrypt(dropBoxsettings.AuthToken);I ma getting a message that says that AccessTokenValue is obsolete, I am unable to find any example of how to use:
...
Hi CTO1,
First of all, why do you need access token at all??? Clarify to yourself it! 🤷 You already have a client. Why don't you use it? 😉
Next, you are using the former (got at authorization time) access token!!! - not the actualized one. 😁 Be more careful! After some time (at most 4 hours) every access token expires. That's why you are getting the posted error message. 😉
Hope this clarifies matter.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!