OAuth signature


#1

Hi and thanks in advanced.

I’m a new programmer and right now i’m trying to work with the Twitter API but when i reach the oauth section and creating a OAuth signature its not the same that is shown at the bottom of the page https://dev.twitter.com/docs/auth/creating-signature#note-lexigraphically and its quite bugging me, i don’t know if at the bottom its suppose to be the real value or just a random value, cause when i do it i don’t have the same value.


#2

The value at the bottom is correct given the keys listed in that page. If you’re using your own keys, then the value would be different.

Does your signature base string match the signature base string in the page?


#3

yes i have copied everything and trying to understand it.

<?php

		$parameterString =  'POST&https%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.json&include_entities%3Dtrue%26oauth_consumer_key%3Dxvz1evFS4wEEPTGEFPHBog%26oauth_nonce%3DkYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1318622958%26oauth_token%3D370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb%26oauth_version%3D1.0%26status%3DHello%2520Ladies%2520%252B%2520Gentlemen%252C%2520a%2520signed%2520OAuth%2520request%2521';
		$secret = 'kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw&LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE';
		$key = hash_hmac('sha1',$parameterString,$secret);
	
		echo $key.'<br/><br/>';
		
		$key = strtoupper($key);
		
		echo $key.'<br/><br/>'; 
		
		echo base64_encode($key).'<br/><br/>';
	?></code>

and the echo is:
b679c0af18f4e9c587ab8e200acd4e48a93f8cb6

B679C0AF18F4E9C587AB8E200ACD4E48A93F8CB6

QjY3OUMwQUYxOEY0RTlDNTg3QUI4RTIwMEFDRDRFNDhBOTNGOENCNg==


#4

Just to let you know i found the problem, i forgot to put the True at the end of my hash_hmac…

if i put true it gives me the same value.

Thanks a lot anyways.
You’re respond was really fast that’s a great thing.