I am fairly new to Box Java API. I am trying to use the BoxAPIConnection API to get a connection to Box using client id and secret.
Here is the code that I am using as per the documentation:
BoxAPIConnection api = new BoxAPIConnection(“<client_id>”,“<client_secret>”);
I am getting the following error:
Exception in thread “main” com.box.sdk.BoxAPIResponseException: The API returned an error code 401 | .08eaad29f26b48b94acb1d577e5ceb51f]
at box.java.sdk@4.5.0/com.box.sdk.BoxAPIResponse.toBoxResponse(BoxAPIResponse.java:147)
at box.java.sdk@4.5.0/com.box.sdk.BoxAPIRequest.trySend(BoxAPIRequest.java:616)
at box.java.sdk@4.5.0/com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:380)
at box.java.sdk@4.5.0/com.box.sdk.BoxJSONRequest.send(BoxJSONRequest.java:106)
at box.java.sdk@4.5.0/com.box.sdk.BoxJSONRequest.send(BoxJSONRequest.java:17)
at box.java.sdk@4.5.0/com.box.sdk.BoxAPIRequest.send(BoxAPIRequest.java:347)
at box.java.sdk@4.5.0/com.box.sdk.BoxJSONRequest.send(BoxJSONRequest.java:101)
at box.java.sdk@4.5.0/com.box.sdk.BoxUser.getCurrentUser(BoxUser.java:199)
The code works fine if I call the API using developer token.