basvandorst / StravaPHP

Strava API REST client with OAuth authentication
MIT License
184 stars 67 forks source link

Get "Required option not passed: "access_token"" message, when try to exchange token second time. #94

Open BooleanType opened 11 months ago

BooleanType commented 11 months ago

I test $oauth->getAccessToken() method in this section: https://github.com/basvandorst/StravaPHP#usage-1 When I call it first time with some token, everything is OK, I retrieve the following response:

image

But when I call it second time, I get an InvalidArgumentException:

image

I understand why this happens - there is no "access_token" in response, 'cause response looks like that:

image

But at first it was not obvious to me. Is it possible to handle this? I mean, is it possible to throw another exception, more clear, about exactly invalid authorization code; some exception, that clearly tells us, that we can't use same auth code twice? Then it would be easier to handle this more specific exception.

Thanks.