Tuesday, January 24, 2012

Making HTTP Request/Response for oAuth in PHP using REST API's made easy.

As and on social apps are getting popular, oAuth using PHP is becoming a very common requirement for most of the social app developers. oAuth is an Authentication protocol (http://oauth.net/) that provides a handle for 3rd party website to access a users data from another platform. Most of these oAuth implementations support REST API using PHP.Hence, here is a list of tools and references that can make your PHP oAuth development easy when you are doing a HTTP Request/Response using REST API's.

  • oAuth : Open Authorization has 2 versions (oAuth 1 and 2). It Involves a series of token exchanges between 2 entities. A good presentation of oAuth is given below. oAuth Presentation.
  • cURL : To make a request and get response using PHP cURL is a ultimate option you can think of. Good cURL documentation - cURL docs.
  • oAuth Library: A Library that works across all the oAuth supported websites - oAuth Lib.
  • Signature generator : Generate signatures for oAuth Parameters - PHP Signatures.
  • Twitter oAuth Console : Check for oAuth signing here. Twitter Console.
  • Analyze HTTP Request : Observe HTTP Request and Responses using this wonderful tool. API Kitchen.
  • Fiddler : You can see all the requests and responses happening in your PHP code using the Fiddler. You can integrate cURL in your fiddler - config fiddler 
  • Sample oAuth Test Server - Test Server.
  • The complete guide for oAuth - Hueniverse.
And ofcourse php.net will be the baseline for the PHP part of it. Though there is pear extension for oAuth available in PHP, for better and easy development, oAuth Library is used. 1 key issue with all PHP oauth web apps is that of signing app keys using HMAC_SHA1 or SHA256 and encoding them and passing them to server via the cURL handle. But still this issue may be easily handled by reading about the oAuth specs in oauth.net. Cheers :)

No comments:

Post a Comment