Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 99d3a79

Browse files
committed
📖
1 parent ea68331 commit 99d3a79

40 files changed

+110
-44
lines changed

src/Providers/Amazon.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
use function sprintf;
1717

1818
/**
19-
* Amazon Login/OAuth
19+
* Login with Amazon for Websites (OAuth2)
2020
*
21-
* @see https://login.amazon.com/
22-
* @see https://developer.amazon.com/docs/login-with-amazon/documentation-overview.html
23-
* @see https://images-na.ssl-images-amazon.com/images/G/01/lwa/dev/docs/website-developer-guide._TTH_.pdf
24-
* @see https://images-na.ssl-images-amazon.com/images/G/01/mwsportal/doc/en_US/offamazonpayments/LoginAndPayWithAmazonIntegrationGuide._V335378063_.pdf
21+
* @see https://developer.amazon.com/docs/login-with-amazon/web-docs.html
22+
* @see https://developer.amazon.com/docs/login-with-amazon/conceptual-overview.html
2523
*/
2624
class Amazon extends OAuth2Provider implements CSRFToken, TokenRefresh{
2725

@@ -37,7 +35,6 @@ class Amazon extends OAuth2Provider implements CSRFToken, TokenRefresh{
3735
protected string $authURL = 'https://www.amazon.com/ap/oa';
3836
protected string $accessTokenURL = 'https://www.amazon.com/ap/oatoken';
3937
protected string $apiURL = 'https://api.amazon.com';
40-
protected string|null $apiDocs = 'https://login.amazon.com/';
4138
protected string|null $applicationURL = 'https://sellercentral.amazon.com/hz/home';
4239

4340
/**

src/Providers/AzureActiveDirectory.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
use chillerlan\OAuth\Core\{CSRFToken, OAuth2Provider};
1414

1515
/**
16-
* @see https://docs.microsoft.com/azure/active-directory/develop/v2-app-types
16+
* Microsoft identity platform (OAuth2)
17+
*
18+
* @see https://learn.microsoft.com/en-us/entra/identity-platform/v2-app-types
19+
* @see https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow
20+
* @see https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-client-creds-grant-flow
1721
*/
1822
abstract class AzureActiveDirectory extends OAuth2Provider implements CSRFToken{
1923

src/Providers/BattleNet.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
use function in_array, sprintf, strtolower;
1818

1919
/**
20-
* Battle.net OAuth
20+
* Battle.net OAuth2
2121
*
22-
* @see https://develop.battle.net/documentation
22+
* @see https://develop.battle.net/documentation/guides/using-oauth
2323
*/
2424
class BattleNet extends OAuth2Provider implements ClientCredentials, CSRFToken{
2525

src/Providers/BigCartel.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use const SODIUM_BASE64_VARIANT_ORIGINAL;
1818

1919
/**
20-
* BigCartel OAuth
20+
* BigCartel OAuth2
2121
*
2222
* @see https://developers.bigcartel.com/api/v1
2323
* @see https://bigcartel.wufoo.com/confirm/big-cartel-api-application/
@@ -30,7 +30,7 @@ class BigCartel extends OAuth2Provider implements CSRFToken, TokenInvalidate{
3030

3131
protected string $authURL = 'https://my.bigcartel.com/oauth/authorize';
3232
protected string $accessTokenURL = 'https://api.bigcartel.com/oauth/token';
33-
protected string $revokeURL = 'https://api.bigcartel.com/oauth/deauthorize/%s'; // sprintf() user id!
33+
protected string $revokeURL = 'https://api.bigcartel.com/oauth/deauthorize';
3434
protected string $apiURL = 'https://api.bigcartel.com/v1';
3535
protected string|null $userRevokeURL = 'https://my.bigcartel.com/account';
3636
protected string|null $apiDocs = 'https://developers.bigcartel.com/api/v1';
@@ -70,7 +70,7 @@ public function invalidateAccessToken(AccessToken|null $token = null):bool{
7070
$auth = sodium_bin2base64(sprintf('%s:%s', $this->options->key, $this->options->secret), SODIUM_BASE64_VARIANT_ORIGINAL);
7171

7272
$request = $this->requestFactory
73-
->createRequest('POST', sprintf($this->revokeURL, $this->getAccountID($token)))
73+
->createRequest('POST', sprintf('%s/%s', $this->revokeURL, $this->getAccountID($token)))
7474
->withHeader('Authorization', sprintf('Basic %s', $auth))
7575
;
7676

src/Providers/Bitbucket.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function sprintf;
1717

1818
/**
19+
* Bitbucket OAuth2 (Atlassian)
20+
*
1921
* @see https://developer.atlassian.com/cloud/bitbucket/oauth-2/
2022
*/
2123
class Bitbucket extends OAuth2Provider implements ClientCredentials, CSRFToken, TokenRefresh{

src/Providers/Deezer.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use const PHP_QUERY_RFC1738;
1818

1919
/**
20+
* Deezer OAuth2
21+
*
2022
* @see https://developers.deezer.com/api/oauth
2123
*
2224
* sure, you *can* use different parameter names than the standard ones... and what about JSON?

src/Providers/DeviantArt.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use function sprintf;
1818

1919
/**
20+
* DeviantArt OAuth2
21+
*
2022
* @see https://www.deviantart.com/developers/
2123
*/
2224
class DeviantArt extends OAuth2Provider implements ClientCredentials, CSRFToken, TokenInvalidate, TokenRefresh{

src/Providers/Discogs.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function sprintf;
1717

1818
/**
19+
* Discogs OAuth1
20+
*
1921
* @see https://www.discogs.com/developers/
2022
* @see https://www.discogs.com/developers/#page:authentication,header:authentication-oauth-flow
2123
*/

src/Providers/Discord.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function sprintf;
1717

1818
/**
19+
* Discord OAuth2
20+
*
1921
* @see https://discord.com/developers/docs/topics/oauth2
2022
*/
2123
class Discord extends OAuth2Provider implements ClientCredentials, CSRFToken, TokenRefresh, TokenInvalidate{
@@ -54,7 +56,7 @@ class Discord extends OAuth2Provider implements ClientCredentials, CSRFToken, To
5456
protected string $accessTokenURL = 'https://discordapp.com/api/oauth2/token';
5557
protected string $revokeURL = 'https://discordapp.com/api/oauth2/token/revoke';
5658
protected string $apiURL = 'https://discordapp.com/api';
57-
protected string|null $apiDocs = 'https://discordapp.com/developers/';
59+
protected string|null $apiDocs = 'https://discord.com/developers/';
5860
protected string|null $applicationURL = 'https://discordapp.com/developers/applications/';
5961

6062
/**

src/Providers/Flickr.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function array_merge, sprintf;
1717

1818
/**
19+
* Flickr OAuth1
20+
*
1921
* @see https://www.flickr.com/services/api/auth.oauth.html
2022
* @see https://www.flickr.com/services/api/
2123
*/

src/Providers/Foursquare.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
use function array_merge, explode, sprintf;
1717

1818
/**
19-
* @see https://developer.foursquare.com/docs/
20-
* @see https://developer.foursquare.com/overview/auth
19+
* Foursquare OAuth2
20+
*
21+
* @see https://location.foursquare.com/developer/reference/personalization-apis-authentication
2122
*/
2223
class Foursquare extends OAuth2Provider{
2324

@@ -30,7 +31,7 @@ class Foursquare extends OAuth2Provider{
3031
protected string $accessTokenURL = 'https://foursquare.com/oauth2/access_token';
3132
protected string $apiURL = 'https://api.foursquare.com';
3233
protected string|null $userRevokeURL = 'https://foursquare.com/settings/connections';
33-
protected string|null $apiDocs = 'https://developer.foursquare.com/docs';
34+
protected string|null $apiDocs = 'https://location.foursquare.com/developer/reference/foursquare-apis-overview';
3435
protected string|null $applicationURL = 'https://foursquare.com/developers/apps';
3536

3637
/**

src/Providers/GitHub.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
use function sprintf;
1717

1818
/**
19-
* @see https://developer.github.com/apps/building-integrations/setting-up-and-registering-oauth-apps/
20-
* @see https://developer.github.com/v3/
21-
* @see https://docs.github.com/en/developers/apps/building-github-apps/refreshing-user-to-server-access-tokens
19+
* GitHub OAuth2
20+
*
21+
* @see https://docs.github.com/en/apps/oauth-apps/building-oauth-apps
22+
* @see https://docs.github.com/rest
23+
* @see https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/refreshing-user-access-tokens
2224
*/
2325
class GitHub extends OAuth2Provider implements CSRFToken, TokenRefresh{
2426

@@ -66,7 +68,7 @@ class GitHub extends OAuth2Provider implements CSRFToken, TokenRefresh{
6668
protected string $accessTokenURL = 'https://github.com/login/oauth/access_token';
6769
protected string $apiURL = 'https://api.github.com';
6870
protected string|null $userRevokeURL = 'https://github.com/settings/applications';
69-
protected string|null $apiDocs = 'https://developer.github.com/';
71+
protected string|null $apiDocs = 'https://docs.github.com/rest';
7072
protected string|null $applicationURL = 'https://github.com/settings/developers';
7173

7274
/**

src/Providers/GitLab.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@
1616
use function sprintf;
1717

1818
/**
19+
* GitLab OAuth2
20+
*
1921
* @see https://docs.gitlab.com/ee/api/oauth2.html
2022
*/
2123
class GitLab extends OAuth2Provider implements ClientCredentials, CSRFToken, TokenRefresh{
2224

2325
protected string $authURL = 'https://gitlab.com/oauth/authorize';
2426
protected string $accessTokenURL = 'https://gitlab.com/oauth/token';
2527
protected string $apiURL = 'https://gitlab.com/api';
26-
protected string|null $apiDocs = 'https://docs.gitlab.com/ee/api/README.html';
2728
protected string|null $applicationURL = 'https://gitlab.com/profile/applications';
2829

2930
/**

src/Providers/Google.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
use function sprintf;
1717

1818
/**
19-
* @see https://developers.google.com/identity/protocols/OAuth2WebServer
20-
* @see https://developers.google.com/identity/protocols/OAuth2ServiceAccount
19+
* Google OAuth2
20+
*
21+
* @see https://developers.google.com/identity/protocols/oauth2/web-server
22+
* @see https://developers.google.com/identity/protocols/oauth2/service-account
2123
* @see https://developers.google.com/oauthplayground/
2224
*/
2325
class Google extends OAuth2Provider implements CSRFToken{

src/Providers/GuildWars2.php

+6-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
use function implode, preg_match, sprintf, str_starts_with, substr;
1717

1818
/**
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...
2022
*
2123
* @see https://api.guildwars2.com/v2
2224
* @see https://wiki.guildwars2.com/wiki/API:Main
@@ -34,8 +36,6 @@ class GuildWars2 extends OAuth2Provider{
3436
public const SCOPE_PROGRESSION = 'progression';
3537
public const SCOPE_GUILDS = 'guilds';
3638

37-
protected const AUTH_ERRMSG = 'GuildWars2 does not support authentication anymore.';
38-
3939
protected string $authURL = 'https://api.guildwars2.com/v2/tokeninfo';
4040
protected string $apiURL = 'https://api.guildwars2.com';
4141
protected string|null $userRevokeURL = 'https://account.arena.net/applications';
@@ -62,8 +62,7 @@ public function storeGW2Token(string $access_token):AccessToken{
6262
$tokeninfo = MessageUtil::decodeJSON($this->http->sendRequest($request));
6363

6464
if(isset($tokeninfo->id) && str_starts_with($access_token, $tokeninfo->id)){
65-
$token = $this->createAccessToken();
66-
65+
$token = $this->createAccessToken();
6766
$token->accessToken = $access_token;
6867
$token->accessTokenSecret = substr($access_token, 36, 36); // the actual token
6968
$token->expires = AccessToken::EOL_NEVER_EXPIRES;
@@ -87,15 +86,15 @@ public function storeGW2Token(string $access_token):AccessToken{
8786
* @throws \chillerlan\OAuth\Providers\ProviderException
8887
*/
8988
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.');
9190
}
9291

9392
/**
9493
* @inheritdoc
9594
* @throws \chillerlan\OAuth\Providers\ProviderException
9695
*/
9796
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.');
9998
}
10099

101100
/**

src/Providers/Imgur.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function sprintf;
1717

1818
/**
19+
* Imgur OAuth2
20+
*
1921
* Note: imgur sends an "expires_in" of 315360000 (10 years!) for access tokens,
2022
* but states in the docs that tokens expire after one month.
2123
* Either manually saving the expiry with the token to trigger auto refresh

src/Providers/LastFM.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use const PHP_QUERY_RFC1738;
1919

2020
/**
21+
* Last.fm
22+
*
2123
* @see https://www.last.fm/api/authentication
2224
*/
2325
class LastFM extends OAuthProvider{

src/Providers/MailChimp.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
use function array_merge, sprintf;
1818

1919
/**
20-
* @see http://developer.mailchimp.com/
21-
* @see http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/
20+
* MailChimp OAuth2
21+
*
22+
* @see https://mailchimp.com/developer/
23+
* @see https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/
2224
*/
2325
class MailChimp extends OAuth2Provider implements CSRFToken{
2426

@@ -27,7 +29,7 @@ class MailChimp extends OAuth2Provider implements CSRFToken{
2729

2830
protected string $authURL = 'https://login.mailchimp.com/oauth2/authorize';
2931
protected string $accessTokenURL = 'https://login.mailchimp.com/oauth2/token';
30-
protected string|null $apiDocs = 'https://developer.mailchimp.com/';
32+
protected string|null $apiDocs = 'https://mailchimp.com/developer/';
3133
protected string|null $applicationURL = 'https://admin.mailchimp.com/account/oauth2/';
3234

3335
/**

src/Providers/Mastodon.php

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use const PHP_QUERY_RFC1738;
1919

2020
/**
21+
* Mastodon OAuth2 (v4.x instances)
22+
*
2123
* @see https://docs.joinmastodon.org/client/intro/
2224
* @see https://docs.joinmastodon.org/methods/apps/oauth/
2325
*/

src/Providers/MicrosoftGraph.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
use function sprintf;
1616

1717
/**
18-
* @see https://docs.microsoft.com/graph/permissions-reference
18+
* Microsoft Graph OAuth2
19+
*
20+
* @see https://learn.microsoft.com/en-us/graph/permissions-reference
1921
*/
2022
class MicrosoftGraph extends AzureActiveDirectory{
2123

@@ -32,7 +34,7 @@ class MicrosoftGraph extends AzureActiveDirectory{
3234
];
3335

3436
protected string $apiURL = 'https://graph.microsoft.com';
35-
protected string|null $apiDocs = 'https://docs.microsoft.com/graph/overview';
37+
protected string|null $apiDocs = 'https://learn.microsoft.com/graph/overview';
3638

3739
/**
3840
* @inheritDoc

src/Providers/Mixcloud.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
use function sprintf;
1717

1818
/**
19-
* note: a missing slash at the end of the path will end up in an HTTP/301
19+
* Mixcloud OAuth2
20+
*
21+
* note: a missing slash at the end of the path will end up in a HTTP/301
2022
*
2123
* @see https://www.mixcloud.com/developers/
2224
*/

src/Providers/MusicBrainz.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
use const PHP_QUERY_RFC1738;
1818

1919
/**
20+
* MusicBrainz OAuth2
21+
*
2022
* @see https://musicbrainz.org/doc/Development
2123
* @see https://musicbrainz.org/doc/Development/OAuth2
2224
*/

src/Providers/NPROne.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function in_array, ltrim, rtrim, sprintf, strtolower, str_contains;
1717

1818
/**
19+
* NPR API services (OAuth2)
20+
*
1921
* @see https://dev.npr.org
2022
* @see https://github.com/npr/npr-one-backend-proxy-php
2123
*/

src/Providers/OpenCaching.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function implode, sprintf;
1717

1818
/**
19+
* Opencaching OAuth1
20+
*
1921
* @see https://www.opencaching.de/okapi/
2022
*/
2123
class OpenCaching extends OAuth1Provider{

src/Providers/OpenStreetmap.php

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use function sprintf, strip_tags;
1717

1818
/**
19+
* OpenStreetmap OAuth1 (deprecated)
20+
*
1921
* @see https://wiki.openstreetmap.org/wiki/API
2022
* @see https://wiki.openstreetmap.org/wiki/OAuth
2123
*

src/Providers/OpenStreetmap2.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
use function sprintf, strip_tags;
1717

1818
/**
19+
* OpenStreetmap OAuth2
20+
*
1921
* @see https://wiki.openstreetmap.org/wiki/API
2022
* @see https://wiki.openstreetmap.org/wiki/OAuth
2123
* @see https://www.openstreetmap.org/.well-known/oauth-authorization-server
22-
*
23-
* @see https://github.com/chillerlan/php-oauth-providers/issues/2
2424
*/
2525
class OpenStreetmap2 extends OAuth2Provider implements CSRFToken{
2626

0 commit comments

Comments
 (0)