bertmaclin
bertmaclin

Reputation: 314

Reddit More Children API

I have a site where I fetch reddit comments using Guzzle and Reddits json api. While it tends to be really slow, it works, but I've run into an issue when trying to load more children via the /api/morechildren.json endpoint.

I always receive a 403 forbidden error when trying to get more children. These are the params I am using including the data and the endpoint which I am hitting.

array(2) {
  ["request"]=>
  string(44) "https://www.reddit.com/api/morechildren.json"
  ["data"]=>
  array(6) {
    ["link_id"]=>
    string(10) "t3_cz36xw7"
    ["id"]=>
    string(10) "t1_cz361ai"
    ["depth"]=>
    string(1) "1"
    ["children"]=>
    string(7) "cz36xw7"
    ["sort"]=>
    string(10) "confidence"
    ["api_type"]=>
    string(4) "json"
  }
}

You can see the api I'm trying to hit here: https://www.reddit.com/dev/api/oauth#GET_api_morechildren

No matter what I try, i get 'string(116) "Client error response [url] https://www.reddit.com/api/morechildren.json [status code] 403 [reason phrase] Forbidden"'

Any ideas?

Upvotes: 1

Views: 687

Answers (1)

brimstone
brimstone

Reputation: 3400

Authentication is needed. OAuth is authorisation library but hard to use without 3rd party library. Look at https://github.com/OAuthSwift/OAuthSwift, it's a good authorisation library and easy to use.

Upvotes: 0

Related Questions