Web Integration Token not working to create Webhooks
Hello!
We are working on a web integration with our application and we have hit a road-block.
We are already able to connect the web integration with our application, get an access and refresh token through OAuth using the auth_code, make API calls regarding the file/folder that the integration was called upon and is all working good.
The problem we are facing is that now we need to get notified whenever there's a change or a comment get's added to the file.
Naturally, we thought about webhooks to achieve this.
BUT, whenever we try to make the call to create a webhook, we are getting this back from the API:
Bearer realm="Service", error="insufficient_scope", error_description="The request requires higher privileges than provided by the access token."
Why? How? the token works perfectly fine for everything else we do for that file/folder. Why are we getting this back when trying to create a webhook? Are we missing something?
Any help will be greatly appreciated!
-
Hi ,
My first thought is that the webhook scope may not be set in the application. Can you load up your app on the Box developer console, then go to the configuration section of the app and make sure that the "Manage webhooks" scope is selected for the application? If you're using a JWT / OAuth based application, you'll also need to reauthorize your application in the enterprise for the scopes changes to take effect.
Hope that helps,
Jon
-
Hello and thank you for your answer.
I have gone through your recomendations and unfortunately I'm still facing the same issue.
I'm trying to do something I though was very simple and this is blocking the entire integration.
- I have created a Box partner integration app,
- I have Standard OAuth 2.0 selected (as choosing JWT will take the Web Integration option away).
- I made sure the application scope includes the option "Manage Webhooks"
- The integration just makes an API call with the auth_code and the file_id. The app grabs that info, creates a new client and then tries to register a webhook. Here's the (very simple) code:
//Create box client BoxAPIConnection client = new BoxAPIConnection("my_client_id", "my_client_secret", request.auth_code)
The problem is that when I call BoxWebHook.create on the file (that comes from the Web Integration call) I get back 403 from Box which is the error for Insufficient permissions.
//Create webook String fileId = request.getFile_id(); URL notificationURL = new URL("https://7fd80a11.ngrok.io/api/integrations/box/webhook?token="); BoxFile file = new BoxFile(client, fileId);
BoxWebHook.Info webhookInfo = BoxWebHook.create(file, notificationURL, BoxWebHook.Trigger.FILE_DOWNLOADED);Please help us out here. What are we missing?
Thanks in advance for your time!
Please sign in to leave a comment.
Comments
3 comments