This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ init from chillerlan/php-oauth-providers chillerlan/php-oauth-provi…
- Loading branch information
1 parent
31dd99d
commit 3b2327a
Showing
192 changed files
with
9,672 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
|
||
# https://account.arena.net/applications | ||
GW2_TOKEN= | ||
#GW2_TOKEN_NAME= | ||
|
||
# https://sellercentral.amazon.com/gp/homepage.html | ||
AMAZON_KEY= | ||
AMAZON_SECRET= | ||
AMAZON_CALLBACK_URL= | ||
|
||
# https://develop.battle.net/access/clients | ||
BATTLENET_KEY= | ||
BATTLENET_SECRET= | ||
BATTLENET_CALLBACK_URL= | ||
#BATTLENET_TESTUSER= | ||
|
||
# https://bigcartel.wufoo.com/confirm/big-cartel-api-application/ | ||
BIGCARTEL_KEY= | ||
BIGCARTEL_SECRET= | ||
BIGCARTEL_CALLBACK_URL= | ||
|
||
# bitbucket account settings -> OAuth -> OAuth consumers -> create | ||
BITBUCKET_KEY= | ||
BITBUCKET_SECRET= | ||
BITBUCKET_CALLBACK_URL= | ||
#BITBUCKET_TESTUSER= | ||
|
||
# http://developers.deezer.com/myapps/ | ||
DEEZER_KEY= | ||
DEEZER_SECRET= | ||
DEEZER_CALLBACK_URL= | ||
#DEEZER_TESTUSER= | ||
|
||
# https://www.deviantart.com/developers/apps | ||
DEVIANTART_KEY= | ||
DEVIANTART_SECRET= | ||
DEVIANTART_CALLBACK_URL= | ||
DEVIANTART_TESTUSER= | ||
|
||
# https://www.discogs.com/settings/developers | ||
DISCOGS_KEY= | ||
DISCOGS_SECRET= | ||
DISCOGS_CALLBACK_URL= | ||
#DISCOGS_TESTUSER= | ||
|
||
# https://discordapp.com/developers/applications/me | ||
DISCORD_KEY= | ||
DISCORD_SECRET= | ||
DISCORD_CALLBACK_URL= | ||
#DISCORD_TESTUSER= | ||
|
||
# https://www.flickr.com/services/apps/create/ | ||
FLICKR_KEY= | ||
FLICKR_SECRET= | ||
FLICKR_CALLBACK_URL= | ||
|
||
# https://foursquare.com/developers/ | ||
FOURSQUARE_KEY= | ||
FOURSQUARE_SECRET= | ||
FOURSQUARE_CALLBACK_URL= | ||
#FOURSQUARE_TESTUSER= | ||
|
||
# https://github.com/settings/applications/ | ||
GITHUB_KEY= | ||
GITHUB_SECRET= | ||
GITHUB_CALLBACK_URL= | ||
#GITHUB_TESTUSER= | ||
|
||
# https://gitlab.com/profile/applications | ||
GITLAB_KEY= | ||
GITLAB_SECRET= | ||
GITLAB_CALLBACK_URL= | ||
#GITLAB_TESTUSER= | ||
|
||
# https://developer.gitter.im/apps | ||
GITTER_KEY= | ||
GITTER_SECRET= | ||
GITTER_CALLBACK_URL= | ||
#GITTER_TESTUSER= | ||
|
||
# https://console.developers.google.com/apis/credentials | ||
GOOGLE_KEY= | ||
GOOGLE_SECRET= | ||
GOOGLE_CALLBACK_URL= | ||
GOOGLE_TESTUSER= | ||
|
||
# https://api.imgur.com/oauth2/addclient | ||
IMGUR_KEY= | ||
IMGUR_SECRET= | ||
IMGUR_CALLBACK_URL= | ||
|
||
# https://www.instagram.com/developer/clients/manage/ | ||
INSTAGRAM_KEY= | ||
INSTAGRAM_SECRET= | ||
INSTAGRAM_CALLBACK_URL= | ||
|
||
# http://www.last.fm/api/account/create | ||
LASTFM_KEY= | ||
LASTFM_SECRET= | ||
LASTFM_CALLBACK_URL= | ||
|
||
# https://admin.mailchimp.com/account/oauth2/ | ||
MAILCHIMP_KEY= | ||
MAILCHIMP_SECRET= | ||
MAILCHIMP_CALLBACK_URL= | ||
#MAILCHIMP_TESTUSER= | ||
|
||
# https://{MASTODON INSTANCE}/settings/applications | ||
MASTODON_KEY= | ||
MASTODON_SECRET= | ||
MASTODON_CALLBACK_URL= | ||
MASTODON_INSTANCE=https://mastodon.social | ||
#MASTODON_TESTUSER= | ||
|
||
# https://aad.portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps | ||
MICROSOFT_AAD_KEY= | ||
MICROSOFT_AAD_SECRET= | ||
MICROSOFT_AAD_CALLBACK_URL= | ||
MICROSOFT_AAD_TESTUSER= | ||
|
||
# https://www.mixcloud.com/developers/create/ | ||
MIXCLOUD_KEY= | ||
MIXCLOUD_SECRET= | ||
MIXCLOUD_CALLBACK_URL= | ||
#MIXCLOUD_TESTUSER= | ||
|
||
# https://musicbrainz.org/account/applications | ||
MUSICBRAINZ_KEY= | ||
MUSICBRAINZ_SECRET= | ||
MUSICBRAINZ_CALLBACK_URL= | ||
|
||
# https://dev.npr.org/console | ||
NPRONE_KEY= | ||
NPRONE_SECRET= | ||
NPRONE_CALLBACK_URL= | ||
#NPRONE_TESTUSER= | ||
|
||
# https://www.opencaching.de/okapi/signup.html | ||
OKAPI_KEY= | ||
OKAPI_SECRET= | ||
OKAPI_CALLBACK_URL= | ||
OKAPI_TESTUSER= | ||
|
||
# https://www.openstreetmap.org/user/<USERNAME>/oauth_clients | ||
OPENSTREETMAP_KEY= | ||
OPENSTREETMAP_SECRET= | ||
OPENSTREETMAP_CALLBACK_URL= | ||
#OPENSTREETMAP_TESTUSER= | ||
|
||
# https://www.openstreetmap.org/oauth2/applications | ||
OPENSTREETMAP2_KEY= | ||
OPENSTREETMAP2_SECRET= | ||
OPENSTREETMAP2_CALLBACK_URL= | ||
#OPENSTREETMAP2_TESTUSER= | ||
|
||
# https://www.patreon.com/portal/registration/register-clients | ||
PATREON_KEY= | ||
PATREON_SECRET= | ||
PATREON_CALLBACK_URL= | ||
#PATREON_TESTUSER= | ||
|
||
# https://developer.paypal.com/developer/applications/ | ||
PAYPAL_KEY= | ||
PAYPAL_SECRET= | ||
PAYPAL_CALLBACK_URL= | ||
#PAYPAL_TESTUSER= | ||
|
||
PAYPAL_SANDBOX_KEY= | ||
PAYPAL_SANDBOX_SECRET= | ||
PAYPAL_SANDBOX_CALLBACK_URL= | ||
#PAYPAL_SANDBOX_TESTUSER= | ||
|
||
# https://api.slack.com/apps/ | ||
SLACK_KEY= | ||
SLACK_SECRET= | ||
SLACK_CALLBACK_URL= | ||
#SLACK_TESTUSER= | ||
|
||
# https://soundcloud.com/you/apps/ | ||
SOUNDCLOUD_KEY= | ||
SOUNDCLOUD_SECRET= | ||
SOUNDCLOUD_CALLBACK_URL= | ||
#SOUNDCLOUD_TESTUSER= | ||
|
||
# https://developer.spotify.com/my-applications/ | ||
SPOTIFY_KEY= | ||
SPOTIFY_SECRET= | ||
SPOTIFY_CALLBACK_URL= | ||
#SPOTIFY_TESTUSER= | ||
|
||
# http://steamcommunity.com/dev/apikey | ||
STEAMOPENID_KEY= | ||
STEAMOPENID_SECRET= | ||
STEAMOPENID_CALLBACK_URL= | ||
|
||
# https://dashboard.stripe.com/account/apikeys | ||
STRIPE_KEY= | ||
STRIPE_SECRET= | ||
STRIPE_CALLBACK_URL= | ||
#STRIPE_TESTUSER= | ||
|
||
# https://www.tumblr.com/oauth/apps | ||
TUMBLR_KEY= | ||
TUMBLR_SECRET= | ||
TUMBLR_CALLBACK_URL= | ||
#TUMBLR_TESTUSER= | ||
|
||
# https://www.twitch.tv/kraken/oauth2/clients/new | ||
TWITCH_KEY= | ||
TWITCH_SECRET= | ||
TWITCH_CALLBACK_URL= | ||
TWITCH_TESTUSER= | ||
|
||
# https://developer.twitter.com/apps | ||
TWITTER_KEY= | ||
TWITTER_SECRET= | ||
TWITTER_CALLBACK_URL= | ||
|
||
# https://developer.vimeo.com/apps/ | ||
VIMEO_KEY= | ||
VIMEO_SECRET= | ||
VIMEO_CALLBACK_URL= | ||
#VIMEO_TESTUSER= | ||
|
||
# https://developer.wordpress.com/apps/new/ | ||
WORDPRESS_KEY= | ||
WORDPRESS_SECRET= | ||
WORDPRESS_CALLBACK_URL= | ||
#WORDPRESS_TESTUSER= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/** | ||
* Class OAuthExampleSessionStorage | ||
* | ||
* @created 26.07.2019 | ||
* @author smiley <[email protected]> | ||
* @copyright 2019 smiley | ||
* @license MIT | ||
*/ | ||
|
||
use chillerlan\OAuth\Core\AccessToken; | ||
use chillerlan\OAuth\OAuthOptions; | ||
use chillerlan\OAuth\Storage\{OAuthStorageException, SessionStorage}; | ||
use chillerlan\Settings\SettingsContainerInterface; | ||
use Psr\Log\LoggerInterface; | ||
use Psr\Log\NullLogger; | ||
|
||
class OAuthExampleSessionStorage extends SessionStorage{ | ||
|
||
protected string|null $storagepath; | ||
|
||
/** | ||
* OAuthExampleSessionStorage constructor. | ||
* | ||
* @throws \chillerlan\OAuth\Storage\OAuthStorageException | ||
*/ | ||
public function __construct( | ||
OAuthOptions|SettingsContainerInterface $options = new OAuthOptions, | ||
LoggerInterface $logger = new NullLogger, | ||
string|null $storagepath = null, | ||
){ | ||
parent::__construct($options, $logger); | ||
|
||
if($storagepath !== null){ | ||
$storagepath = trim($storagepath); | ||
|
||
if(!is_dir($storagepath) || !is_writable($storagepath)){ | ||
throw new OAuthStorageException('invalid storage path'); | ||
} | ||
|
||
$storagepath = realpath($storagepath); | ||
} | ||
|
||
$this->storagepath = $storagepath; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function storeAccessToken(AccessToken $token, string $service = null):static{ | ||
parent::storeAccessToken($token, $service); | ||
|
||
if($this->storagepath !== null){ | ||
$tokenfile = sprintf('%s/%s.token.json', $this->storagepath, $this->getServiceName($service)); | ||
|
||
if(file_put_contents($tokenfile, $token->toJSON()) === false){ | ||
throw new OAuthStorageException('unable to access file storage'); | ||
} | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getAccessToken(string $service = null):AccessToken{ | ||
$service = $this->getServiceName($service); | ||
|
||
if($this->hasAccessToken($service)){ | ||
return (new AccessToken)->fromJSON($_SESSION[$this->tokenVar][$service]); | ||
} | ||
|
||
if($this->storagepath !== null){ | ||
$tokenfile = sprintf('%s/%s.token.json', $this->storagepath, $service); | ||
|
||
if(file_exists($tokenfile)){ | ||
return (new AccessToken)->fromJSON(file_get_contents($tokenfile)); | ||
} | ||
} | ||
|
||
throw new OAuthStorageException(sprintf('token for service "%s" not found', $service)); | ||
} | ||
|
||
} |
Oops, something went wrong.