public static function ClientsServicesFlickr::getToken in Web Service Clients 6
Prepares a hashed token for the service, based on current time, the required service and config values; serviceKey and serviceDomain
Parameters
$serviceConfig: stdClass: A service configuration as returned by Clients::load()
$serviceMethod: string: Name of service method to access
Return value
array: a valid token
1 call to ClientsServicesFlickr::getToken()
- ClientsServicesFlickr::getUser in backends/
clients_flickr/ clients_flickr.inc - Connects to Drupal Services and logs in the user provided in the config. Returns a session for the user. @todo needs error catching in case service is down
File
- backends/
clients_flickr/ clients_flickr.inc, line 37 - Defines Flickr services and calls
Class
Code
public static function getToken($connection, $serviceMethod) {
// @todo - http://www.flickr.com/services/api/auth.howto.web.html
$timestamp = (string) time();
$nonce = uniqid();
$hashParameters = array(
$timestamp,
$connection->configuration['domain'],
$nonce,
$serviceMethod,
);
$hash = hash_hmac("sha256", implode(';', $hashParameters), $connection->configuration['servicekey']);
return array(
'hash' => $hash,
'domain' => $connection->configuration['domain'],
'timestamp' => $timestamp,
'nonce' => $nonce,
);
}