R2 programmatically create token

You need to generate via the R2 Tab -> "Manage R2 API Tokens"
8 Replies
faizan1038
faizan10384mo ago
I want to create via the API because it's a part of the deployment service. Is that not possible?
Chaika
ChaikaOP4mo ago
very possible The Access Key is the ID of the token The Secret is the sha256sum of the token value echo -n "token" | sha256sum
faizan1038
faizan10384mo ago
Sorry I am not sure I understand. I need to create one set of credentials per bucket via the API.
Chaika
ChaikaOP4mo ago
You can see what the manage r2 api tokens does to create a bucket scoped one
No description
Chaika
ChaikaOP4mo ago
Cloudflare API Documentation
Interact with Cloudflare's products and services via the Cloudflare API
Chaika
ChaikaOP4mo ago
if you're confused: play around with the dashboard w/ network tools open, it uses the same create token endpoint. You can see how you can create scoped tokens via it, and then you just take the ID for the Access Key and the Secret Key is sha256sum the api token value/secret
Chaika
ChaikaOP4mo ago
Cloudflare Docs
Authentication | Cloudflare R2 docs
You can generate an API token to serve as the Access Key for usage with existing S3-compatible SDKs or XML APIs.
faizan1038
faizan10384mo ago
Okay got it. Thanks
Want results from more Discord servers?
Add your server