Some errors as response in oauth/access_token

oauth
php
api

#1

I am developing TYPO3 extension uses the adapter pattern to connect with Twitter. I have followed the steps in https://dev.twitter.com/web/sign-in/implementing and other pages and forums, but I have a problem with this request. Now the authentication process is as follows:

  1. The url is generated correctly to log in on Twitter.
  2. In the callback url I get the outh_token and the oauth_verified.
  3. But at the moment of sending the oauth_verified by get access_token to to the account, it generates two errors.

In first case I have used POST

public function getAccessToken($oauthVerifier){
  $accesToken = $this->api->post('oauth/access_token', array("oauth_verifier" => "$oauthVerifier"));
  return $accesToken;
}

I get error with > code: 34, message: Sorry, that page does not exist

And if I use OAUTH

public function getAccessToken($oauthVerifier){
  $accesToken = $this->api->oauth('oauth/access_token', array("oauth_verifier" => "$oauthVerifier"));
  return $accesToken;
}

Generates a exception with message Invalid request token

I am using Abrham TwitterOAuth with PHP 5.6 and TYPO3 7.6


#2

Using the oauth method is correct. Make sure when you build the TwitterOAuth object you include the request token and secret after the consumer key and secret.


#3

Thank you, It was very helpful. I was creating the TwitterOauth object only with consumer keys. I have to create the object two times, and save the temporal tokens.