-
Notifications
You must be signed in to change notification settings - Fork 22
Can't send requests with the access token. #21
Comments
I am having same problem, it looks like same issue as zendframework/zendframework#5478 |
Yup, it's piss poor. |
Awesome, did you just volunteer for writing a test/fix, @Gisleburt? :) |
Haha, sorry, GitHub apparently doesn't like to mention that you're email replys will be put here, I didn't even notice it was from GitHub. My poorly worded point stands though, this module doesn't work, the documentation is crazy wrong and it hasn't been fixed, or even looked at in 3 months. I did already fix one bug but this is beyond me. My solution: I stopped using ZF2. |
@Gisleburt that's perfectly fine, just keep an eye at where you're replying :) |
@Gisleburt the right method to call for Zend\Http\Client is |
I don't think it's just documentation issue, try example from http://framework.zend.com/manual/2.2/en/modules/zendservice.twitter.html it fails because adapter is not set. |
@machek Enrico specifically said as much:
|
@Gisleburt, @machek I was unable to reproduce the issue, I tried this example and it works fine. Can you check this code on your side? I suggest to execute a |
@ezimuel Here is simple test calling Twitter API - https://gist.github.com/machek/11385838 When code uses latest version 2.3.0 it dies on: I can't help myself but it look like a bug, if there is required extra step, I would say it should throw an Exception, not die. Thanks |
@machek The test code that you provided is for |
The best solution to all this that I've found so far, is to comment out lines 76-79 in ZendOAuth\Client. The base class method getAdapter() is being overriden, for what purpose I can't tell. If you want to accept this solution, I can submit a pull-request? |
what i did to fix this is on ZendOAuth\Client getAdapter function i used parent::getAdapter() the Http\Client.php getAdapter function has a check if the adapter is set, so i think the same should apply on the ZendOAuth\Client. |
@xyfantis you are absolutely right, calling the parent method solves the problem, but since it is in the vendor folder, not a solution. Looking at the repository, the fix is only on master, no stable release for a few months, I wonder why, but after adding "zendframework/zendoauth": "dev-master" to composer and updating, problem solved. @ezimuel you are not able to reproduce the problem cos in the example we are explicitly calling the setAdapter method, but with the example on the documentation, only using the config array passed to the ZendService\Twitter\Twitter($options), that does not happen, so we end up having the error. On master, the getAdapter was removed and we use the parent one, that checks first if it is set, if not, grab from the configuration. |
This repository has been closed and moved to laminas/laminas-oauth; a new issue has been opened at laminas/laminas-oauth#6. |
This might be a documentation issue, but you don't seem to be able to send requests using the access token.
From http://framework.zend.com/manual/2.0/en/modules/zendoauth.introduction.html
(It's also worth noting the difference between
$config
and$configuration
)However
\Zend\Http\Client
which is returned byZendOAuth\OAuth::getHttpClient
does not have a method calledrequest()
.I've also tried
send()
but this throws the errorThe text was updated successfully, but these errors were encountered: