for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Baguette\Mastodon\Grant;
use Baguette\Mastodon\Client as MastodonClient;
use Baguette\Mastodon\Service\AuthFactory;
use Baguette\Mastodon\Service\Scope;
use GuzzleHttp\ClientInterface as GuzzleHttpClient;
/**
* Mastodon grant request class
*
* @author USAMI Kenta <[email protected]>
* @copyright 2017 Baguette HQ
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL-3.0
*/
abstract class Grant
{
* @param Client $http
* @param AuthFactory $factory
* @param Scope $scope
abstract public function auth(GuzzleHttpClient $http, AuthFactory $factory, Scope $scope);
* @return string
protected static function getPathToOAuthToken(MastodonClient $client)
return sprintf('%s://%s/oauth/token', $client->getScheme(), $client->getHostname());
}
* @return array
protected static function getFormParams(AuthFactory $factory)
return [
'client_id' => $factory->client_id,
'client_secret' => $factory->client_secret,
];