16
16
use function implode , preg_match , sprintf , str_starts_with , substr ;
17
17
18
18
/**
19
- * GW2 does not support authentication (anymore) but the API still works like a regular OAUth API, so...
19
+ * Guild Wars 2
20
+ *
21
+ * Note: GW2 does not support authentication (anymore) but the API still works like a regular OAUth API, so...
20
22
*
21
23
* @see https://api.guildwars2.com/v2
22
24
* @see https://wiki.guildwars2.com/wiki/API:Main
@@ -34,8 +36,6 @@ class GuildWars2 extends OAuth2Provider{
34
36
public const SCOPE_PROGRESSION = 'progression ' ;
35
37
public const SCOPE_GUILDS = 'guilds ' ;
36
38
37
- protected const AUTH_ERRMSG = 'GuildWars2 does not support authentication anymore. ' ;
38
-
39
39
protected string $ authURL = 'https://api.guildwars2.com/v2/tokeninfo ' ;
40
40
protected string $ apiURL = 'https://api.guildwars2.com ' ;
41
41
protected string |null $ userRevokeURL = 'https://account.arena.net/applications ' ;
@@ -62,8 +62,7 @@ public function storeGW2Token(string $access_token):AccessToken{
62
62
$ tokeninfo = MessageUtil::decodeJSON ($ this ->http ->sendRequest ($ request ));
63
63
64
64
if (isset ($ tokeninfo ->id ) && str_starts_with ($ access_token , $ tokeninfo ->id )){
65
- $ token = $ this ->createAccessToken ();
66
-
65
+ $ token = $ this ->createAccessToken ();
67
66
$ token ->accessToken = $ access_token ;
68
67
$ token ->accessTokenSecret = substr ($ access_token , 36 , 36 ); // the actual token
69
68
$ token ->expires = AccessToken::EOL_NEVER_EXPIRES ;
@@ -87,15 +86,15 @@ public function storeGW2Token(string $access_token):AccessToken{
87
86
* @throws \chillerlan\OAuth\Providers\ProviderException
88
87
*/
89
88
public function getAuthURL (array |null $ params = null , array |null $ scopes = null ):UriInterface {
90
- throw new ProviderException ($ this :: AUTH_ERRMSG );
89
+ throw new ProviderException (' GuildWars2 does not support authentication anymore. ' );
91
90
}
92
91
93
92
/**
94
93
* @inheritdoc
95
94
* @throws \chillerlan\OAuth\Providers\ProviderException
96
95
*/
97
96
public function getAccessToken (string $ code , string |null $ state = null ):AccessToken {
98
- throw new ProviderException ($ this :: AUTH_ERRMSG );
97
+ throw new ProviderException (' GuildWars2 does not support authentication anymore. ' );
99
98
}
100
99
101
100
/**
0 commit comments