CORS origin for urlfetch

Asked Nov 20, 2024·3 replies·Last activity 1 year ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

I have an API that I would like to use with urlfetch() is there a Nightbot specific domain or IP that I can add to my CORS Origin environment variables in order to let only Nightbot access the endpoint?

3 replies

Nightbot's URL fetcher doesn't need CORS to work. Is there an error message you're receiving?

Right, but I don't want to add * to accepted CORS locations on my API. Does that make sense?

Why not? You can check the request and allow/deny the request based on for example the user-agent. Or if it's sensitive data I would add a querystring parameter with some sort of token to validate the request.