We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Nenciu D.
11 years agoNew member | Level 1
Access token expiry, Folder or file parentId,
Hello,
I have multiple questions:
1.How to check if access token has expired? For the moment I created a new DropboxClient and if it is null I make a new request for another access token.
2.Is it possible to get the parent id of a folder or file? I've seen that every metadata of a file or a folder has an id , but they don't have a parentId.
3.Why can't I make a request for a token without redirect_uri? In documentation it apears to be optional , but when I pass it as null to GetAuthorizeUri() method it crashes because redirect_uri is null in a token request (https://api.dropboxapi.com/1/oauth2/token).
Thanks
4 Replies
Replies have been turned off for this discussion
- Steve M.11 years ago
Dropbox Staff
- Access tokens don't expire, but they can be invalidated by a user who revokes your app's access. To test an access token, just make an API call and handle the exception for a 401 response. I'm not sure what null value you're checking for, but nothing client-side will tell you if the access token is valid; you need to test it by calling a server-side endpoint.
- I assume you're asking about the file IDs in API v2, right? I think you'll need to use the path to determine the parent and call get_metadata on the parent to get its ID. (E.g. if the path is /foo/bar/baz, call get_metadata on /foo/bar.)
- Per the OAuth 2 spec, the redirect_uri passed to /token has to match the one used with /authorize, so if you used one there, then you need to use one when you call /token. I believe this requirement is for security purposes, though I'm not 100% sure what security threat it mitigates.
- m. chiuq11 years agoNew member | Level 1
I also want to ask about id.
What is the root folder id?
I use the explorer and even I type / or let it empty, I could not get the metadata of the root folder?
Is anything I type wrong?
- Steve M.11 years ago
Dropbox Staff
"m. chiuq", your post seems unrelated to this thread. Please start your own thread to ask a new question.
- m. chiuq11 years agoNew member | Level 1
OK, I create a new thread:
https://www.dropboxforum.com/hc/en-us/community/posts/203922673-What-is-root-folder-id
thanks!
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!