Closed mastermike14 closed 9 years ago
I've tested it, and you're right. Somehow, the ClientId object isn't turned into a string when building the url. I've fixed this in the TraktProvider
class.
I'm still getting the "There was an invalid Oauth request from Trakt" error. Tried with "fixed" version. vendor\wubs\trakt\src\Wubs\Trakt\Trakt.php on line 71
What's the code you use to obtain the access token? Are you calling $trakt->getAccessToken($code);
from the url you have provided as the callback url? Trakt uses that url to send you the code to obtain an access code with
I just thought of why you are getting the error. It's a dumb mistake of me. Inside Trakt::getAccessToken()
is a check if the request is valid, and it checks if the required $_GET
variable is available. This off course breaks the manual request!
Should be fixed in bc034e6652a2aa48ffbf6872c9a691d60cc13d52
Fixed! Unfortunately another error now: Catchable fatal error: Argument 1 passed to League\OAuth2\Client\Provider\AbstractProvider::setResultUid() must be of the type array, null given
The request is sent using guzzle and the response is null. Ive tested the parameters and the correct ones are there but maybe they aren't being sent for some reason
I'll check later today. Haven't been able to find a good way to automatically test the whole oauth process. I need someone elses thoughts on that. Will spinn up a dev environment on my personal server to debug the process later tonight.
Op zo 22 mrt. 2015 17:39 schreef Mastermike notifications@github.com:
The request is sent using guzzle and the response is null. Ive tested the parameters and the correct ones are there but maybe they aren't being sent for some reason
— Reply to this email directly or view it on GitHub https://github.com/megawubs/trakt-api-wrapper/issues/4#issuecomment-84651211 .
I think the issue is with Trakt. When I manually go to the OAuth url, I get this:
I've requested access to their google+ group and tweeted at them. But don't think it'll be fixed today.
It's a bug inside Guzzle or the OAuth2 Client.
Ive dumped the params in oauth2 abstract provider and the correct params are set. Ive dumped the response from the getAccessToken in the oauth2 Abstract Provider and its NULL which is raising the message "Uncaught exception 'InvalidArgumentException' with message 'Required option not passed: access_token ' "
when calling the function request in AbstractRequest provider one of the variables is preceded by 3 periods(...) on line 136 of AbstractRequest.php
@mastermike14, those dots are Variable-length argument lists.
I've been debugging the process a bit more. And it seems something with the $trakt->authorize();
call goes wrong. I have not been able to pin point what it exactly is. When I request an OAuth token from my API application page and put the code displayed in $trakt->getAccessToken()
it works. But when I use $trakt->authorize()
and use the code I get from that call inside $trakt->getAccessToken()
it fails with the error invalid_grand
with the description: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
I've been trying to get it working. But so far without results. Even tried to go back to just simple curl requests (http://laravel.io/bin/9v3qy) but I still get back "invalid_grant". But the weird part is, that when I put the code I get back form the `$trakt->authorize(); call in post man, I'm able to get an acces token.
Thanks for the fix @megawubs auth works fine now. I'm haven a bit of an issue with the dots (... / Variable-length argument lists) as well, since my development wampserver doesn't support PHP 5.6 (it runs on 5.5.12) so it's throwing an error.
Parse Error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE)
That's 5.6 indeed. Will think about a way to make it support 5.5. Can you make a new issue for this?
Op ma 23 mrt. 2015 16:34 schreef webslash notifications@github.com:
Thanks for the fix @megawubs https://github.com/megawubs auth works fine now. I'm haven a bit of an issue with the dots (... / Variable-length argument lists) as well, since my development wampserver doesn't support PHP 5.6 (it runs on 5.5.12) so it's throwing an error.
Parse Error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE)
— Reply to this email directly or view it on GitHub https://github.com/megawubs/trakt-api-wrapper/issues/4#issuecomment-85052574 .
the auth code can only be used once. If you try to use it again you get the "invalid_grant" error.
when i call that method with a valid oauth code i get "There was an invalid Oauth request from Trakt"