r/redditdev • u/Iron_Fist351 • 1d ago
Reddit API 403 error when attempting to access a JSON feed with bearer authorization?
I'm attempting to make the following get request to a private moderator feed, the URL for which I obtained through https://old.reddit.com/prefs/feeds.
get_request:
URL: "https://old.reddit.com/r/mod/about/modqueue/.json?feed=*********&user=*********"
headers:
User-Agent: "pipedream/1"
Authorization: "Bearer {{bearer_token}}}"
My authorization for this request is a bearer token that the code obtains from https://www.reddit.com/api/v1/access_token in a previous step. A new bearer token is requested every time the code runs, so the token expiring isn't a concern.
However, the request continuously fails with a status code 403. This code worked perfectly fine up until about 3 months ago, after which this error began occuring. The bearer token I'm using is also the same token that's being outputted from my POST request to https://www.reddit.com/api/v1/access_token, which returns successfully with the bearer token every time.
Did something change with Reddit's API in the past few months? Does anyone know any troubleshooting steps I could take to try and fix this?
Note: I'm not currently working with Python. This is a raw GET request that I'm making through a Pipedream workflow.
Here's the error response body, if it helps:
<!doctype html>
<html>
<head>
<title>Blocked</title>
<style>
body {
font: small verdana, arial, helvetica, sans-serif;
width: 600px;
margin: 0 auto;
}
h1 {
height: 40px;
background: transparent url(//www.redditstatic.com/reddit.com.header.png) no-repeat scroll top right;
}
</style>
</head>
<body>
<h1>whoa there, pardner!</h1>
<p>Your request has been blocked due to a network policy.</p>
<p>Try logging in or creating an account <a href=https://www.reddit.com/login/>here</a> to get back to browsing.</p>
<p>If you're running a script or application, please register or sign in with your developer credentials <a href=https://www.reddit.com/wiki/api/>here</a>. Additionally make sure your User-Agent is not empty and is something unique and descriptive and try again. if you're supplying an alternate User-Agent string,
try changing back to default as that can sometimes result in a block.</p>
<p>You can read Reddit's Terms of Service <a href=https://www.reddit.com/wiki/api/>here</a>.</p>
<p>if you think that we've incorrectly blocked you or you would like to discuss
easier ways to get the data you want, please file a ticket <a href=https://support.reddithelp.com/hc/en-us/requests/new?ticket_form_id=21879292693140>here</a>.</p>
<p>when contacting us, please include your ip address which is: <strong>3.84.50.106</strong> and reddit account</p>
</body>
</html>