24 lines
563 B
PHP
24 lines
563 B
PHP
<?php
|
|
|
|
use Vazaha\Mastodon\Factories\ApiClientFactory;
|
|
|
|
require_once("bootstrap.php");
|
|
|
|
|
|
$factory = new ApiClientFactory();
|
|
$client = $factory->build()
|
|
->setBaseUri('https://'.$conf['instance']);
|
|
|
|
// get user based authorization:
|
|
// generate authorize url
|
|
// (we'll reuse the app created above)
|
|
$authUrl = $client->getAuthorizeUrl(
|
|
'code',
|
|
$conf['client_id'],
|
|
'https://admin.piaille.fr/callback.php',
|
|
'read write admin:read admin:write',
|
|
);
|
|
|
|
// redirect user to this url, where they can log in:
|
|
echo "URL: ".$authUrl."&state=".$argv[1]."\n";
|
|
|