How to integrate R2 with an application

  1. Create a bucket. Do not make it public - leave the default settings as is
  2. Create an API token with access to the bucket you want to use. You can create a tpken that has access too all the buckets too, but it is not good practice. Details in https://developers.cloudflare.com/r2/api/s3/tokens/. Copy the Access key id and Secret Access Key and put it into the .env file
  3. Add the bucketname.account.r2cloudstorage in nbext.config.js Give bthe bucket name in the S3 client config Use the s3-request-presigner SDK to get signed download urls
 
comments powered by Disqus