What does "error_description:access_denied" mean in BoxServerException

StackOverflow https://stackoverflow.com/questions/22616564

  •  20-06-2023
  •  | 
  •  

Pregunta

I ma trying to refresh my access token using the refresh token I have but I get following exception:

com.box.boxjavalibv2.exceptions.BoxServerException: {"error":"access_denied","error_description":"Access denied"}

Please tell me what could be wrong with my request and why I am getting access_denied

If I send invalid refresh token, then I get

Caused by: com.box.boxjavalibv2.exceptions.BoxServerException: {"error":"invalid_grant","error_description":"Invalid refresh token"}

I want to know the reasons for access_denied.

------------------- relevant code ------------------

BoxOAuthRequestObject requestObject = BoxOAuthRequestObject.refreshOAuthRequestObject(refreshToken, clientId,
        clientSecret);
try {
    // Authenticate with the new token
    BoxOAuthToken boxOAuthToken = client.getOAuthManager().refreshOAuth(requestObject);
¿Fue útil?

Solución 2

I've received that error when attempting to call API methods that accessed the "Manage an enterprise" methods, while my application was defined as "Read and write all files and folders".

Make sure you set the appropriate checkbox at the application level.

Otros consejos

Not really sure what's going on without more information of your code.

One thing is that the sdk does auto-refresh the OAuth token. So basically you don't need to refresh it yourself. Please check https://github.com/box/box-java-sdk-v2#authenticate

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top