Skip to main content
Question

How to login using UserID in JAVA BOX SDK

  • May 21, 2025
  • 4 replies
  • 20 views

Forum|alt.badge.img

I am using BOX JAVA SDK to access the box functionalities. I've got enterpriseId and also userId to login into Box as an enterprise user. I am able to login using enterpriseId but not with userId. BoxDeveloperEditionAPIConnection boxjwtconnection=new BoxDeveloperEditionAPIConnection(userId,devedienttype.USER,clientId,clientSecret,jwtenrypref,null); This is the exception I am getting when I am trying to login using userId. Exception in thread "main" com.box.sdk.BoxAPIException: The API returned an error code: 401 at com.box.sdk.BoxAPIResponse.(BoxAPIResponse.java:69) at com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:421) at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:209) at com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:184) at com.box.sdk.BoxUser.getCurrentUser(BoxUser.java:139) Where I am doing mistakes? Any solutions? Thanks in advance

4 replies

Forum|alt.badge.img

i believe you have to have your client_id user-enabled.


Forum|alt.badge.img

what does that mean? How to enable Client_Id user ?


Forum|alt.badge.img

I think this may help:

 

https://docs.box.com/reference#as-user-1

 

 


Forum|alt.badge.img

I tried that but getting an 403 forbidden error.