Friday, May 3, 2013

Phirehose:Authorization Error when fetching tweets by Locations

Error

Error 401 UNAUTHORIZED

HTTP ERROR: 401

Problem accessing /1/statuses/filter.json. Reason: Unauthorized


Only when you use "$sc->setLocations" function


Solution

The issue is related to missing location parameter when signing oAuth message

Add the following missing code at the end of getAuthorizationHeader() function, just before return $this->getOAuthHeader('POST', $url, $requestParams); in OauthPhirehose.php file



        if (count($this->locationBoxes) > 0)
        {
             $requestParams['locations'] = implode(',', $this->locationBoxes);
        }

No comments:

Post a Comment