/** * Checks to see if the code and headers indicate an expired OAuth token. * If so, requests a new one. * * @private */ function checkExpired($code, $headerParser) { if ($code != 401) return; // HTTP Unauthorized $authenticateHeader = $headerParser->get('WWW-Authenticate'); if (!$authenticateHeader) return; if (!preg_match('/oauth_problem="([^"]+)"/', $authenticateHeader, $match)) return; $oauth_problem = $match[1]; if ($oauth_problem == 'token_expired') { YahooLogger::error('Access token expired. Please fetch a new one'); } if ($oauth_problem == 'consumer_key_unknown') { YahooLogger::error('Consumer Key unkown. Please check that the Consumer Key is valid.'); } if ($oauth_problem == 'additional_authorization_required') { YahooLogger::error('The app identified by this Consumer Key is not authorized to access this resource. Authorization is defined under Access Scopes on the application\'s settings page.'); } }