Skip to main content
Solved

Limit OAuth 2.0 to specific folder_id during authorization

  • July 18, 2023
  • 3 replies
  • 279 views

Hi there,

I would like to know is it possible to limit the OAuth authorization to specific folder much like how the scopes parameter works:

https://account.box.com/api/oauth2/authorize?response_type=code&client_id=ly1nj6n11vionaie65emwzk575hnnmrk&redirect_uri=http://example.com/auth/callback&folder_id=somefolderid

Best answer by smartoneinok Box

It does seem like there is some functionality to do this… but it is not in our documentation. Let me know if you have any issues using it in practice.

https://{{account.box.com}}/api/oauth2/authorize?response_type=code&client_id=INSERT_CIIENT_ID&redirect_uri=http://example.com/auth/callback&folder_id=INSERT_FOLDER_ID

3 replies

smartoneinok Box
Forum|alt.badge.img
  • Senior Developer Advocate
  • 181 replies
  • July 18, 2023

Hey -

Thanks for posting on the forum! I don’t think so…at least not in that way since OAuth 2.0 is meant to basically provide access to any content you have access to… but I could be wrong. I’ve never tried. Let me confirm with some folks and report back.

I know you can downscope a token - which may suit your needs better. Checkout this guide for instructions on that!

Alex, Box Developer Advocate


smartoneinok Box
Forum|alt.badge.img
  • Senior Developer Advocate
  • 181 replies
  • Answer
  • July 18, 2023

It does seem like there is some functionality to do this… but it is not in our documentation. Let me know if you have any issues using it in practice.

https://{{account.box.com}}/api/oauth2/authorize?response_type=code&client_id=INSERT_CIIENT_ID&redirect_uri=http://example.com/auth/callback&folder_id=INSERT_FOLDER_ID

  • Author
  • New Participant
  • 1 reply
  • July 18, 2023

Hi there,

Thank you for providing me feedback, I’ll and it and see how it goes from there.

Cheers