Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Lukag
2 years agoCollaborator | Level 8
Access dropbox file - Authentication failed because the remote party has closed the transport stream
i'm new in this type of access.
I wrote this code but i have the error in objet to recover the list of files in dropbox.
Dim token As String
token = "sl.B6........."
Dim _command As String
_command = "https://api.dropboxapi.com/2/files/list_folder"
Dim Request As HttpWebRequest
Request = HttpWebRequest.Create(_command)
Request.Method = "GET"
Request.KeepAlive = True
Request.ContentType = "application/json"
Request.UserAgent = "Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
Request.AllowAutoRedirect = True
Request.Headers.Add("Authorization", "Bearer " & token)
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
Dim Response As HttpWebResponse = Request.GetResponse()
32 Replies
Replies have been turned off for this discussion
- Здравко2 years agoLegendary | Level 20
Yes.
- Lukag2 years agoCollaborator | Level 8
- Здравко2 years agoLegendary | Level 20
@Lukag Try read again the thread I linked to. There have been all steps shown. That you have posted is the thing you don't need encoded mandatory - i.e. execute by hand single time only outside your application. The last step, you skipped above, is mandatory to reside in your code. It may generate new access tokens whenever needed. I don't know how to say it more clear!
- Lukag2 years agoCollaborator | Level 8
I thought that the token was quite alway the same.
So.. the first step i must autenticate the app / user by this :
https://www.dropbox.com/oauth2/authorize?client_id=<APP_KEY>&response_type=code
After i use https://api.dropboxapi.com/oauth2/token
Example: code flow access token request
Right ?
- Lukag2 years agoCollaborator | Level 8
I understood the nonsense I was saying, I continue to study. Thank you
- Здравко2 years agoLegendary | Level 20
Do you understand that there are different tokens? 🧐
Lukag wrote:...
Duration token is 4 hours, if generate now and tomorrow i'll use it in my app , the server'll answer me that token in expired / invalid ...
What token do you take in mind above? 🤔
Read again entire thread here and linked resources. 👆 Don't jump over!
- Lukag2 years agoCollaborator | Level 8
i dont understand some steps.
Duration token is 4 hours, if generate now and tomorrow i'll use it in my app , the server'll answer me that token in expired / invalid . So should i refhresh by Api ?
- Здравко2 years agoLegendary | Level 20
Lukag wrote:... Can i do it run time by api ?
Definitely NO! API cannot self authenticate. 🙂 If that was possible, it would be a big security HOLE.
Actually, the refresh step in my description above (that you don't like) does exactly this, but it's different thing. There refresh token is used for authentication (valid refresh token). 😉
- Lukag2 years agoCollaborator | Level 8
My scenario in where by web app my customer look and open his file in dropbox.
Just one form or two, just one user or two.
I think that token access should be good. However if in future my scenario will change i'll change also my code.
So , if you agree with me i'll continue on this way .
So i'll need generate a new token every time. Can i do it run time by api ?
- Здравко2 years agoLegendary | Level 20
Hm..🤔 To be honest, I don't understand what you mean. Maybe the actual question should be do you need long term access or not?! This is your design decision though. 😉
If you need a single shot (i.e. something that would be run occasionally) application for your own use only, getting access token every time might be better (and simplest) solution. In all other cases use of some form of OAuth might be better solution (my proposal is the simplest OAuth flow for long term use - it is suitable for server side applications, as your looks like according your description).
The decision is yours.
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!