samedi 21 février 2015

Yii2 authclient with Strava API


Vote count:

0




I have configured yii2-authclient to use both Facebook and Google successfully - both for connecting, and for logging in. I would now like to do the same for Strava but I don't really know how to do it.


I have added the Strave config to config/web.php and I now have a button on my login page. I click this button, enter my Strava credentials in the popup, redirected to my site where I'm presented with an Exception: yii\authclient\InvalidResponseException. The message returned is:



Request failed with code: 404, message: <!DOCTYPE html>
<html class='logged-out responsive old-login' lang='en-US' xmlns:fb='http://ift.tt/zbanWc' xmlns:og='http://ift.tt/OQX3IK' xmlns='http://ift.tt/1tp2ee8'>
......
</html>


The content of the HTML in the exception message is the same as that of http://ift.tt/1FGc3Jl, which is just their "The page you're looking for does not exist.".


Any help would be appreciated.


Here's my class:



class Strava extends OAuth2{
public $authUrl = 'http://ift.tt/1pxVp5D';
public $tokenUrl = 'http://ift.tt/1hcihSX';
public $apiBaseUrl = 'http://ift.tt/1zVdJGq';
public $scope = 'write';

protected function initUserAttributes(){
return $this->api('me', 'GET');
}

protected function defaultName(){
return 'strava';
}

protected function defaultTitle(){
return 'Strava';
}
}


And here's my configuration:



'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\GoogleOAuth',
'clientId' => 'MY_ID',
'clientSecret' => 'MY_SECRET',
],
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'authUrl' => 'http://ift.tt/1FGc1Bd',
'clientId' => 'MY_ID',
'clientSecret' => 'MY_SECRET',
],
'strava' => [
'class' => 'my\namespace\Strava',
'clientId' => 'MY_ID',
'clientSecret' => 'MY_SECRET',
],
],


asked 42 secs ago







Yii2 authclient with Strava API

Aucun commentaire:

Enregistrer un commentaire