Skip to main content

400 Bad Request While downloading the file using java

  • August 8, 2023
  • 2 replies
  • 303 views

  • Participating Frequently

I am using this java code to download the file BoxFile file = new BoxFile(api, “1233071276329”); BoxFile.Info info = file.getInfo();

FileOutputStream stream = new FileOutputStream(info.getName());
file.download(stream);
stream.close(); but I am getting this {“error”:“unauthorized_client”,“error_description”:“The "box_subject_type" value is unauthorized for this client_id”} could anyone please help me.

2 replies

CodeBoxSeb
  • Box Employee
  • August 8, 2023

Hi @user57 ! 🙂

I think you’re using a OAuth 2.0 Auth app,
Is it a file you have access to, when you’re using Box.com in your browser ?

box_subject_type refers to either an enterprise, or a user.

If you’re trying to download a file with a standard OAuth 2.0 app, make sure you have access to this specific file if you’re logged in with a specific user.


  • Author
  • Participating Frequently
  • August 8, 2023

Hi @CodeBoxSeb
yes I have access to that specific file and also I am using the command Line interface from there I can access the file but using this code I am getting the error.