splitbee / notion-api-worker

Notion as CMS with easy API access
MIT License
1.56k stars 197 forks source link

Getting AccessDenied on uploaded images #44

Closed Utkarshbhimte closed 3 years ago

Utkarshbhimte commented 3 years ago

I am getting this error when I am using images from my notion doc image

This is my notionId: 96defe8701444f0782cc9b428929c79a

I am rendering the page content using react-notion-x, those are working fine but the image URLs I am getting from the payload are not working

Would appreciate any help on this one 😊

tobiaslins commented 3 years ago

Hey!

I just checked with react-notion and it seems to work fine for us: https://react-notion.com/96defe8701444f0782cc9b428929c79a

The URL needs to be signed by the client!

Utkarshbhimte commented 3 years ago

Hey, thanks, how exactly do you "sign" a URL here for images? I am creating a custom integration here.

tobiaslins commented 3 years ago

@Utkarshbhimte https://github.com/splitbee/react-notion/blob/master/src/utils.ts#L46-L62

Try to prefix the URL you get from the worker with https://www.notion.so/image/ and be sure to call encodeURIComponent on the URL

Utkarshbhimte commented 3 years ago

Thanks 😊