Build on the Reddit Data API from the browser, the way Reddit expects
Reddit's API needs an OAuth token and a descriptive User-Agent, and the browser lets you send neither safely. Proxify keeps the token on the server and sets the User-Agent for you.
Access to fetch at 'https://oauth.reddit.com/r/webdev/hot' from origin 'https://your-app.example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
HTTP/2 200
access-control-allow-origin: https://your-app.example.com
x-proxify-ratelimit-remaining: 9999
Two things the browser can't do for you
Reddit's Data API authenticates with OAuth and asks every client to identify itself with a unique, descriptive User-Agent. Browsers don't let page code set User-Agent, and an OAuth token in front-end code can be read by anyone.
Depending on the endpoint, calls made straight from the page can also fail the browser's CORS check, so most guides end with 'build a backend'.
How Proxify helps
Configured from the dashboard, enforced on every request.
-
OAuth token in the vault
Store the access token as a secret and send a {{secret.NAME}} placeholder. The real token is inserted on the server.
-
Only sent to Reddit
Bind the secret to oauth.reddit.com and Proxify refuses to send it anywhere else.
-
A proper User-Agent
Send X-Proxify-Set-User-Agent and Proxify sets the real User-Agent header upstream, which browsers otherwise forbid.
-
Stay inside the limits
Per-key rate limits and quotas help keep your app within Reddit's request limits.
-
Locked to your app
A live key only answers your app's origins, so other sites can't use your token through it.
-
Replay while developing
Record responses while you build so you aren't calling the API on every reload.
Example
An authenticated listing request
- Register an app in your Reddit account preferences and obtain an OAuth access token.
- Access tokens expire. Refresh the token with Reddit and update the secret in the dashboard.
- Bind the secret to oauth.reddit.com so it is never sent to any other host.
const target = 'https://oauth.reddit.com/r/webdev/hot?limit=10';
const res = await fetch(`https://api.proxifyedge.com/proxy?url=${encodeURIComponent(target)}`, {
headers: {
'X-API-Key': 'pk_your_public_key',
'X-Proxify-Upstream-Authorization': 'Bearer {{secret.REDDIT_ACCESS_TOKEN}}',
// Browsers can't set User-Agent; Proxify sets it upstream from this header.
'X-Proxify-Set-User-Agent': 'web:com.example.your-app:v1.0 (by /u/your_username)',
},
});
const listing = await res.json();
Questions
Something else? Get in touch or read the docs.
Can I read Reddit without OAuth?
Reddit's Data API Terms govern how its data may be accessed and used. Use OAuth and follow those terms; Proxify doesn't change what you are allowed to do.
Why do I need a custom User-Agent?
Reddit asks every API client to send a unique, descriptive User-Agent, and may limit clients that don't. Browsers block page code from setting it, so Proxify sets it for you from X-Proxify-Set-User-Agent.
Can Proxify refresh my Reddit token?
No. Proxify stores and inserts the token you give it. Refresh it with Reddit and replace the secret.
Is Proxify affiliated with Reddit?
No. Proxify is an independent service that forwards the requests you make with your own Reddit app credentials.
Use the Reddit Data API under Reddit's Data API Terms and Developer Terms, including their rate limits and their rules on commercial use and data retention. Proxify is not affiliated with Reddit.