Skip to content

Commit c4e2700

Browse files
author
DraperStudio
committed
Upgrade to Manager 2.0
1 parent 8f40a3a commit c4e2700

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"email": "[email protected]"
88
}],
99
"require": {
10-
"php": ">=5.5.0",
11-
"socialiteproviders/manager": "~1.0"
10+
"php": "^5.6 || ^7.0",
11+
"socialiteproviders/manager": "~2.0"
1212
},
1313
"autoload": {
1414
"psr-4": {

src/EtsyAbstractProvider.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22

33
namespace SocialiteProviders\Etsy;
44

5-
use Symfony\Component\HttpFoundation\RedirectResponse;
65
use Laravel\Socialite\Contracts\Provider as ProviderContract;
7-
use Laravel\Socialite\One\AbstractProvider;
6+
use SocialiteProviders\Manager\OAuth1\AbstractProvider;
7+
use Symfony\Component\HttpFoundation\RedirectResponse;
88

99
abstract class EtsyAbstractProvider extends AbstractProvider implements ProviderContract
1010
{
11+
/**
12+
* Unique Provider Identifier.
13+
*/
14+
const IDENTIFIER = 'ETSY';
15+
1116
/**
1217
* Redirect the user to the authentication page for the provider.
1318
*
@@ -41,13 +46,11 @@ protected function getToken()
4146
$temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier')
4247
);
4348
} else {
44-
4549
$temp = unserialize($_COOKIE['oauth_temp']);
4650

4751
return $this->server->getTokenCredentials(
4852
$temp, $this->request->get('oauth_token'), $this->request->get('oauth_verifier')
4953
);
50-
5154
}
5255
}
5356

src/Provider.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
namespace SocialiteProviders\Etsy;
44

5-
use Laravel\Socialite\One\User;
6-
use SocialiteProviders\Etsy\EtsyAbstractProvider;
5+
use SocialiteProviders\Manager\OAuth1\User;
76

87
class Provider extends EtsyAbstractProvider
98
{
109
/**
11-
* {@inheritDoc}
10+
* Unique Provider Identifier.
11+
*/
12+
const IDENTIFIER = 'ETSY';
13+
14+
/**
15+
* {@inheritdoc}
1216
*/
1317
public function user()
1418
{

src/Server.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,46 @@
22

33
namespace SocialiteProviders\Etsy;
44

5-
use Laravel\Socialite\One\User;
65
use League\OAuth1\Client\Credentials\TokenCredentials;
7-
use League\OAuth1\Client\Server\Server as BaseServer;
6+
use SocialiteProviders\Manager\OAuth1\Server as BaseServer;
7+
use SocialiteProviders\Manager\OAuth1\User;
88

99
class Server extends BaseServer
1010
{
1111
/**
12-
* {@inheritDoc}
12+
* {@inheritdoc}
1313
*/
1414
public function urlTemporaryCredentials()
1515
{
1616
return 'https://openapi.etsy.com/v2/oauth/request_token';
1717
}
1818

1919
/**
20-
* {@inheritDoc}
20+
* {@inheritdoc}
2121
*/
2222
public function urlAuthorization()
2323
{
2424
return 'https://www.etsy.com/oauth/signin';
2525
}
2626

2727
/**
28-
* {@inheritDoc}
28+
* {@inheritdoc}
2929
*/
3030
public function urlTokenCredentials()
3131
{
3232
return 'https://openapi.etsy.com/v2/oauth/access_token';
3333
}
3434

3535
/**
36-
* {@inheritDoc}
36+
* {@inheritdoc}
3737
*/
3838
public function urlUserDetails()
3939
{
4040
return 'https://openapi.etsy.com/v2/users/__SELF__';
4141
}
4242

4343
/**
44-
* {@inheritDoc}
44+
* {@inheritdoc}
4545
*/
4646
public function userDetails($data, TokenCredentials $tokenCredentials)
4747
{
@@ -56,23 +56,23 @@ public function userDetails($data, TokenCredentials $tokenCredentials)
5656
}
5757

5858
/**
59-
* {@inheritDoc}
59+
* {@inheritdoc}
6060
*/
6161
public function userUid($data, TokenCredentials $tokenCredentials)
6262
{
6363
return $data['results'][0]['user_id'];
6464
}
6565

6666
/**
67-
* {@inheritDoc}
67+
* {@inheritdoc}
6868
*/
6969
public function userEmail($data, TokenCredentials $tokenCredentials)
7070
{
7171
return $data['results'][0]['primary_email'];
7272
}
7373

7474
/**
75-
* {@inheritDoc}
75+
* {@inheritdoc}
7676
*/
7777
public function userScreenName($data, TokenCredentials $tokenCredentials)
7878
{

0 commit comments

Comments
 (0)