cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

Access token expiry, Folder or file parentId,

Access token expiry, Folder or file parentId,

Nenciu D.
New member | Level 1

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 4

Steve M.
Dropbox Staff
  1. 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.
  2. 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.)
  3. 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. chiuq
New 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.
Dropbox Staff

"m. chiuq", your post seems unrelated to this thread. Please start your own thread to ask a new question.

m. chiuq
New member | Level 1
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    m. chiuq New member | Level 1
  • User avatar
    Steve M. Dropbox Staff
What do Dropbox user levels mean?