I'm trying to retrieve a request token from Flickr (per https://www.flickr.com/services/api/auth.oauth.html) but keep receiving an invalid signature message:
oauth_problem=signature_invalid&debug_sbs=GET&https%3A%2F%2Fwww.flickr.com%2Fservices%2Foauth%2Frequest_token&oauth_callback%3Dexample.com%2Ffr_callback.php%26oauth_consumer_key%3D {KEY} %26oauth_nonce%3D52d9d8fc7ba83ec7183dddf09df45685%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1441557821
I have tried many configurations for the signature, and flickr's docs leave a lot of unanswered questions for me. I'm wondering if someone here might be able to look at my code here and see what I am doing incorrectly. The function I am calling to produce a signature is below. Perhaps I am not encoding something properly?
function get_fr_Sig () {
global $fr_key;
global $nonce;
global $timestamp;
$base_string = 'GET&https://www.flickr.com/services/oauth/request_token
&oauth_callback=http://example.com/fr_callback.php
&oauth_consumer_key='.$fr_key.
'&oauth_nonce='.$nonce.
'&oauth_signature_method=HMAC-SHA1
&oauth_timestamp='.$timestamp;
$signature = hash_hmac('sha1', $base_string, $fr_key.'&'.$r_token_secret);
return $signature;
}
I'm sure I'm not doing something right and I'm a bit of a newb so don't be too harsh here!