Skip to content

Commit

Permalink
More graph 2.0 updates
Browse files Browse the repository at this point in the history
* Facebook no longer provides username, use full name for nickname
* Update avatar url to include v2.3
  • Loading branch information
adamwathan committed Apr 1, 2015
1 parent 6e7e33b commit b473109
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/FacebookProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function userId()

protected function nickname()
{
return $this->getProviderUserData('username');
return $this->getProviderUserData('name');
}

protected function fullName()
Expand All @@ -72,7 +72,7 @@ protected function fullName()

protected function avatar()
{
return 'https://graph.facebook.com/'.$this->userId().'/picture';
return 'https://graph.facebook.com/v2.3/'.$this->userId().'/picture';
}

protected function email()
Expand Down
8 changes: 4 additions & 4 deletions tests/FacebookProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public function it_can_retrieve_a_normalized_user()
$user = $provider->getUser();

$this->assertEquals('187903669', $user->id);
$this->assertEquals('john.doe', $user->nickname);
$this->assertEquals('John Doe', $user->nickname);
$this->assertEquals('John Doe', $user->full_name);
$this->assertEquals('example@example.com', $user->email);
$this->assertEquals('https://graph.facebook.com/187903669/picture', $user->avatar);
$this->assertEquals('john@example.com', $user->email);
$this->assertEquals('https://graph.facebook.com/v2.3/187903669/picture', $user->avatar);
$this->assertEquals(
'nrQpCDgUzGXbh7K6KwDBmj5uEBM4ElZDzYRth3ZouKUHDcZtX0dRcWAnIVpCzVjlCKbFTJ69gLA3nUKcFiQZmrtgwfN5L4cVMCfDPfnpGo4aoThPG6LdnlTiigkTLxPU3tnLokQqYyo5TmGK8Pxwdwfx3StUxFBSnCenFikR6riEYtUYMKfXuILy0hvRAZUZCGdXOzIgCTw9jKNegtWpgdoiacgkFHN',
'RUXRIAxWwxVYKk3b1vrTACPUiAGImrszVsBXb2FQZZZXbd6JNzkZRAgZLCdAiCfKHrPanMTS8BAHLPqugidBcCNkUmz3y72XMZRZWw4SEGdczB2HygsA7oQOufDIbgZBtyA1KaznugApacfId5HIdZtIEh47ZLEa0BrJrBICZBf4uCWCGD5OBM40RpvTVaAux2vCv5wU9ZZzm91WAVtSC5ufoZmr3Ty',
$user->access_token
);
}
Expand Down
14 changes: 7 additions & 7 deletions tests/_fixtures/facebook_accesstoken.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
X-FB-Rev: 1648763
X-FB-Rev: 1669049
Pragma: no-cache
Cache-Control: private, no-cache, no-store, must-revalidate
Facebook-API-Version: v1.0
Facebook-API-Version: v2.3
Expires: Sat, 01 Jan 2000 00:00:00 GMT
X-FB-Debug: g/vwFVcMECWLE7F+LK/7BB+iKK4QhTqtP1pUiGpRnibF/0amNQY3TQDO5erl332j1BSGyJGukouOVmZVTaeWRg==
Date: Thu, 19 Mar 2015 03:23:04 GMT
X-FB-Debug: aWKI40XqPBE1YkeMX7Awln6RzgWl+JQpbYY7MWkiP2cRZ0TNadSG8rTnlHQovxjP+5fTYg1ZfkOVKsiMdJB9Jg==
Date: Wed, 01 Apr 2015 12:47:40 GMT
Connection: keep-alive
Content-Length: 252
Content-Length: 285

access_token=nrQpCDgUzGXbh7K6KwDBmj5uEBM4ElZDzYRth3ZouKUHDcZtX0dRcWAnIVpCzVjlCKbFTJ69gLA3nUKcFiQZmrtgwfN5L4cVMCfDPfnpGo4aoThPG6LdnlTiigkTLxPU3tnLokQqYyo5TmGK8Pxwdwfx3StUxFBSnCenFikR6riEYtUYMKfXuILy0hvRAZUZCGdXOzIgCTw9jKNegtWpgdoiacgkFHN&expires=5183867
{"access_token":"RUXRIAxWwxVYKk3b1vrTACPUiAGImrszVsBXb2FQZZZXbd6JNzkZRAgZLCdAiCfKHrPanMTS8BAHLPqugidBcCNkUmz3y72XMZRZWw4SEGdczB2HygsA7oQOufDIbgZBtyA1KaznugApacfId5HIdZtIEh47ZLEa0BrJrBICZBf4uCWCGD5OBM40RpvTVaAux2vCv5wU9ZZzm91WAVtSC5ufoZmr3Ty","token_type":"bearer","expires_in":5183288}
14 changes: 7 additions & 7 deletions tests/_fixtures/facebook_user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ HTTP/1.1 200 OK
Content-Type: text/javascript; charset=UTF-8
Last-Modified: 2014-12-21T00:04:42+0000
Access-Control-Allow-Origin: *
X-FB-Rev: 1648763
ETag: "78d60efd0cb688737609ace1304b8acddf71e67d"
X-FB-Rev: 1669049
ETag: "e732c03dd9c5d6f0a2aa6bb7b2e78e4e36bf5a4e"
Pragma: no-cache
Cache-Control: private, no-cache, no-store, must-revalidate
Facebook-API-Version: v1.0
Facebook-API-Version: v2.3
Expires: Sat, 01 Jan 2000 00:00:00 GMT
X-FB-Debug: bEBMCN9l/H9YnNU5C18u202lXUImsxep9o7ntaTapzHiP4X2BQC6Yx6vhMXB4AsLL664Px0wTdeGcGTXuCL9+A==
Date: Thu, 19 Mar 2015 03:24:33 GMT
X-FB-Debug: WkWb9eeV7Aw1YJagx9Ffj0XzEQuDZhaUlOsNLGbf+es8H5Tq2aW4iBn6G0tUh1WRTG4Rbd+nIaTTR1Mbhz2b8Q==
Date: Wed, 01 Apr 2015 12:49:00 GMT
Connection: keep-alive
Content-Length: 764
Content-Length: 295

{"id":"187903669","birthday":"03\/15\/1987","email":"example\u0040example.com","first_name":"John","gender":"male","last_name":"Doe","link":"https:\/\/www.facebook.com\/john.doe","locale":"en_US","name":"John Doe","timezone":-4,"updated_time":"2014-12-21T00:04:42+0000","username":"john.doe","verified":true,"work":[]}
{"id":"187903669","birthday":"03\/15\/1987","email":"john\u0040example.com","first_name":"John","gender":"male","last_name":"Doe","link":"http:\/\/www.facebook.com\/187903669","locale":"en_US","name":"John Doe","timezone":-4,"updated_time":"2014-12-21T00:04:42+0000","verified":true}

0 comments on commit b473109

Please sign in to comment.