2-register_token_and_authentify.php 446 Bytes
Newer Older
Max Koder's avatar
Max Koder committed
1 2 3 4 5 6 7 8 9 10 11
<?php

require 'tootophp\autoload.php';

$tootoPHP = new TootoPHP\TootoPHP('mastodon.xyz');

$app = $tootoPHP->registerApp('TootoPHP', 'http://max-koder.fr');
if ( $app === false) {
    throw new Exception('Problem during register app');
}

Max Koder's avatar
Max Koder committed
12
$token = $app->registerAccessToken('write_here_your_token_got_in_step_1');
Max Koder's avatar
Max Koder committed
13 14 15 16

$bearer_token = $app->authentify("your_email@mail.com", "Your_Password");

// Now Token is registered in JSON file