basvandorst / StravaPHP

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

Fix for access tokens and 401 responses #45

Closed maltehuebner closed 4 years ago

maltehuebner commented 6 years ago

Strava rejected my requests with 401 as I did not send a valid access token. It turned out we handed over the whole token object, but Strava did only want to see the access token as a string. This is just a quick fix, maybe it would be nicer to introduce a new method like

public function getAccessToken(): string
{
    return $this->token->getToken();
}
vredeling commented 5 years ago

This depends on the way the rest object is instantiated. The @param on Rest::__construct() suggests $token should be a string. So I've added a new PR to use a different solution. See commit: 10aaad133916b13495b2c90cf03d0d17e0453a63