What is Nostr?
Simon Willison /
npub13v9…w5eu
2024-04-06 17:22:40

Simon Willison on Nostr: If I have a JSON API that's protected by "Authorization: Bearer XXX" API tokens, what ...

If I have a JSON API that's protected by "Authorization: Bearer XXX" API tokens, what are the arguments against sticking these headers on it?
```python
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Headers: Authorization
```
I want users of my API to be able to access it via JavaScript from any host

The best argument I can think of is that it may encourage people to leak their private API token in publicly visible HTML documents, anything else?
Author Public Key
npub13v97j0kknscwnf5pt87nsn7cxzxwfwl3dsu7ss8qsq7ukmqgwg8q84w5eu