POST

/oauth/token

Request Code - authorization_code

Last Update : 2019.07.05
// get parameter check
if (isset($_GET['code']))
{
	// set return data
	$tokenRequest = new \MastodonApi\Oauth\Token\Request();
	$tokenRequest->code = $_GET['code'];
	$tokenRequest->grant_type = 'authorization_code';

	// get access token
	$response = $mastodonApi->oauth->token($tokenRequest);
}

Request Code - password

Last Update : 2019.07.05
// set token request
$tokenRequest = new \MastodonApi\Oauth\Token\Request();
$tokenRequest->grant_type = 'password';
$tokenRequest->username = '{Mastodon Login E-Mail}';
$tokenRequest->password = '{Mastodon Login Password}';

// get access token
$response = $mastodonApi->oauth->token($tokenRequest);

Response Data

Last Update : 2019.07.05
MastodonApi\Oauth\Token\Response Object
(
	[access_token] => {Your Apps Access Token}
	[token_type] => Bearer
	[scope] => read
	[created_at] => {time()}
)
access_token string (43)
token_type string
scope string
created_at int

AdSense