A few days of hard done nights were all inspired by faulty encodings. Talk about “Hello World” experiences LOL. Keeping things in mind, to really smooth things up between Objective-C and PHP, in any Objective-C functions needing to encode/decode strings like PHP, here’s the encoding type:
Do not interchange this with any other or things will go wrong Here are snippets to generate HMAC-SHA1 hashes in its Base64 form encoded correctly for OAUTH v1.0a authentication.
I’ve been toying with Urbanesia’s OAuth provider API calls in Android these few hours regretting why it is so complicated in Java compared to PHP hehehe. Since OAuth’s requirement to generate a signature is using HMAC SHA1 to sign the whole POST & GET requests, I had to find a way to do it in Android’s Java.
So I scour Google to look for answers but sadly the results isÂ surprisinglyÂ scarce. I wanted to make a standardize OAuth client for Urbanesia’s API but the standard libraries provided by the Android SDK is not what I’ve expected. For this to work, will need to download Apache Commons Codec Library here. So without further ado, here are the codes.