cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know more about how you can find anything and protect everything? Check it out 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: How can I solve this error: Property 'refresh_token' does not exist on type 'object'?

How can I solve this error: Property 'refresh_token' does not exist on type 'object'?

AdnanL
Helpful | Level 5
Go to solution

Hello,

I am trying to make a replica in Typescript of the Dropbox webhook (that converts md files to html) that was built in Python. I copy-pasted the authentication flow from this example and I had to change a few things along the way till I reached this error that I couldn't solve.

Here is a screenshot:

AdnanL_0-1646046326059.png

The documentation of the SDK are quite poor they didn't help at all.

Thanks in advance.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

@AdnanL Thanks. That output looks correct and should allow the code to get the "token.result.refresh_token" value. When you say you "did not run the script before I posted this issue", do you mean that when you originally posted this and said you "reached this error that I couldn't solve", that was only a warning you saw in your IDE, and not an error occurring during execution? It sounds like this was just a TypeScript type warning, and not something preventing this code from running properly. Is that correct?

 

By the way, for future reference, do not post your full access or refresh token values like this. I've redacted them from your screenshot now.

View solution in original post

10 Replies 10

Здравко
Legendary | Level 20
Go to solution

Hi @AdnanL,

What is showing the log performed on previous line? 🤔

Greg-DB
Dropbox Staff
Go to solution

@AdnanL Yes, as Здравко requested, it would probably be helpful if you indicated what you're getting in the log. As a matter of security though, please don't share any actual full access/refresh token value.

 

It would likely also be helpful if you could share some more context, such as:

  • the rest of the relevant you're running for the authorization flow; you linked to the example you're working from but you mentioned you had to change a few things
  • the version number of the Dropbox SDK you're using
  • the name and version number of whatever platform you're using, etc.

AdnanL
Helpful | Level 5
Go to solution

Thanks for the replies,@Greg-DB @Здравко

 

This is all the code in my file: https://www.toptal.com/developers/hastebin/basayuhope.typescript, what I am trying to do is to attack dropbox accounts to my dropbox app (A replica of the webhook example by dropbox).

 

I am using Node.js 16.13.1 with Dropbox version 10.24.0, the API was different from the example so I had to create a new instance of the DropboxAuth class and change some function names and alter some parameters that were passed to the functions, no big deal.

Greg-DB
Dropbox Staff
Go to solution

@AdnanL Thanks for following up. Can you indicate what you're getting in the console though? Specifically, the "Token Result" value being logged on line 53 from the code you shared. Please don't show actual full access/refresh token values however.

AdnanL
Helpful | Level 5
Go to solution

Sorry for the late reply @Greg-DB, I did not run the script before I posted this issue.

Screenshot_31.png

Greg-DB
Dropbox Staff
Go to solution

@AdnanL Thanks. That output looks correct and should allow the code to get the "token.result.refresh_token" value. When you say you "did not run the script before I posted this issue", do you mean that when you originally posted this and said you "reached this error that I couldn't solve", that was only a warning you saw in your IDE, and not an error occurring during execution? It sounds like this was just a TypeScript type warning, and not something preventing this code from running properly. Is that correct?

 

By the way, for future reference, do not post your full access or refresh token values like this. I've redacted them from your screenshot now.

AdnanL
Helpful | Level 5
Go to solution

Yes @Greg-DB, it was just a TS warning. Here is my progress so far: https://www.toptal.com/developers/hastebin/rijajosiwa.coffeescript, everything works in this /auth route script. But I still have some problems:

First, when I click on Allow the auth route runs and I get the expected console logs but it stays in a reload status and doesn't redirect me to any page afterward.

AdnanL_0-1646688978679.png

and second, when I go to the connected apps I can find my app as shown here but not in the https://www.dropbox.com/developers/apps page.

 

AdnanL_1-1646689024343.png

Third thing, the app doesn't create any new folder in the Apps folder, or should I do that manually?

AdnanL_2-1646689354479.png

 

I hope you won't mind the long message and thank you very much for your valuable help.

Здравко
Legendary | Level 20
Go to solution

@AdnanL wrote:

..., when I click on Allow the auth route runs and I get the expected console logs but it stays in a reload status and doesn't redirect me to any page afterward.

...


Hi @AdnanL,

As far as you haven't filled the response with something to show and haven't redirected to such a page, such a behavior is normal. Either render as HTML whatever you want to show or redirect accordingly.

 


@AdnanL wrote:

..., when I go to the connected apps I can find my app as shown here but not in the https://www.dropbox.com/developers/apps page.

...


Developers page shows only applications particular user develops, nothing else. Is it the same user context developing the application or... just a test user?! 🙂 Connected application page shows all application particular user links the account to. Info can coincide, when developer only link own application(s), but it's a different meanings. That's it.

 


@AdnanL wrote:

...

Third thing, the app doesn't create any new folder in the Apps folder, or should I do that manually?

...


Seems you application has full access to the client account content and no limitation to just an application folder. In such cases, such a folder isn't need and that's why no automatically created. You have access to all folders anyway. In case of restricted application such a folder is mandatory, cosa this folder is the application's root folder, the account root is inaccessible to the application.

Hope this clarifies matter.

Brogers
Dropbox Staff
Go to solution

Hello @AdnanL,

 

I have filed a ticket to fix the TS warning in the SDK although I cannot guarantee when it will be completed. 

 

You mentioned that you were having issues with redirecting upon accepting the OAuth request. Upon clicking the `Allow` button, Dropbox redirects you to the URL you passed in. If this URL does not have any visual components or redirects to a desktop app, this will not result in a new webpage being opened. As @Здравко mentioned, you can either render some HTML you would like your users to see or redirect accordingly. 

 

Regarding your connected apps, https://www.dropbox.com/developers/apps will show any apps that are created by the currently signed in account while the connected apps page under account settings will show any apps that the currently signed in account has linked (whether owned by themselves or another developer). 

 

As @Здравко mentioned, this app has full account access and thus can access folders in any location in the connected Dropbox accounts. Because of this, we do not automatically create a folder for this application. You can read more about the different app types on the developer site https://www.dropbox.com/developers/reference/developer-guide?_tk=guides_lp&_ad=guides1&_camp=referen... 

 

Hope this helps,

Brad

Need more support?