twitter-php
twitter-php copied to clipboard
Method that retrieves an oauth Request Token for 3-legged authentication
The purpose of this pull-request is to use the existing infrastructure of this plugin to retrieve a request token from Twitter that can be used to generate 3-legged authentication flows. Some changes had to be made to the Request method in order to properly decode the response from twitter. (text/html)
I created a custom getRequestToken method to make it simple to retrieve an access token in array format that can then be passed back to the client side as JSON rather than a URL Encoded string.
- Reference to issue: https://twittercommunity.com/t/why-is-the-return-type-of-post-oauth-request-token-text-html-when-it-is-clearly-not-html/698
Links:
- https://developer.twitter.com/en/docs/authentication/api-reference/request_token
- https://developer.twitter.com/en/docs/apps/callback-urls
- https://developer.twitter.com/en/docs/authentication/api-reference/authorize
Changelog:
- Refactored the Request Method to decode and return an array from Twitter responses that are formatted as
text/html
andapplication/x-www-form-urlencoded
-POST oauth/request_token
. - Added a method that utilizes the existing Request Method and retrieves an oauth request token from twitter to be used for 3-legged authentication.
- Revised Readme with examples on how to use the new method.
- Updated PhpDoc and some cleanup.