23 lines
589 B
PHP
23 lines
589 B
PHP
<?php
|
|
|
|
use Vazaha\Mastodon\Factories\ApiClientFactory;
|
|
|
|
require_once("bootstrap.php");
|
|
|
|
$factory = new ApiClientFactory();
|
|
$client = $factory->build()
|
|
->setBaseUri('https://'.$conf['instance']);
|
|
|
|
$code=$argv[1];
|
|
|
|
// obtain a token using this code:
|
|
$token = $client->methods()->oauth()->token(
|
|
'authorization_code', // NB: different from app token call above!
|
|
$code,
|
|
$conf['client_id'],
|
|
$conf['client_secret'],
|
|
'https://admin.piaille.fr/callback.php',
|
|
null,
|
|
'read write admin:read admin:write',
|
|
);
|
|
echo "TOKEN: ".$token->access_token."<br>\n";
|