Skip to main content
Question

Annotations bar not visible in Content Preview(Box-ui-elements)

  • May 22, 2025
  • 7 replies
  • 55 views

Forum|alt.badge.img

I tried to use this https://github.com/box/box-content-preview-demo repo to preview the document I uploaded into Box. But I always get the permission as "can_annotate":false in the response. I generated client token using the following command,

curl -i -X POST "https://api.box.com/oauth2/token" -H "Content-Type: application/x-www-form-urlencoded" -d "subject_token=****" -d "subject_token_type=urn:ietf:params:oauth:token-type:access_token" -d "scope=item_upload item_preview annotation_edit base_preview annotation_view_self" -d "resource=https://api.box.com/2.0/folders/151673097340" -d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange"

I used App token(primary access token of custom application) as subject token. I'm using "limited access" custom app in box. Can somebody help me find the things I'm missing, to see annotations options in content preview?

7 replies

Forum|alt.badge.img

Hello, 

This might be happening due to the limited access app restrictions. Have you tried making a regular custom app instead? 

Thanks, 

Alex, Box Developer Advocate


Forum|alt.badge.img

Yep, thanks, I just noticed the limited access app had restricted scopes. I'll try creating a custom app.

Regards,

Venkat


Forum|alt.badge.img

i am using custom app using 16.0.0 version of box-ui-elements but annotations are not working are they supported in box-ui-elements ?


Forum|alt.badge.img

Forum|alt.badge.img

i saw it but he used js not react i am facing issue with box-ui-elemnets react, can you help me looking into it why its not working...


Forum|alt.badge.img

Hi Ayush,

There is another example using REACT on this article, and I've just updated it to include a preview with annotations.

Check out the GitHub repo.

Please note that I'm using a really old version of node and the dependencies are messy.

Also make sure you update the hard coded and invalid token with a fresh one from your app console in the app.js file.

The file to preview is also hard coded so make sure you upload a file and use you own file id in the app.js file.

Hope this helps, cheers.

Here is a screen shot:

BOX1_bLCa-JJMRBBbVWS-rdbQ5w.png


Forum|alt.badge.img

I have used the same example, the only thing what I was missing was that I was not using box-annotation library, thankyou for your help, i am also stuck in one more thing that is i am getting http error while working on sign request using prepare url