Token not valid to write toots...
Opened this issue · 1 comments
pperrin commented
This is the hacked down version of my code (variables are defined in the 'live' version).
The app is setup read/write/follow on the server for a user, the user info so correctly shown from the verify, but try to toot and it blows.
I have tried various things (an admin account, login instead of using the profile token etc) -- but all with the same result...
Any ideas? Or suggestions on where to look to debug this?
<?php
require_once 'mastodon_api.php';
$mastodon_api = new Mastodon_api();
$mastodon_api->set_url($url);
$mastodon_api->create_app($appname,null,null,$url);
$mastodon_api->set_client($key,$secret);
$mastodon_api->set_token($token,'bearer');
print '<pre>';
print "verify\n";
$ret = $mastodon_api->accounts_verify_credentials();
var_dump($ret);
print "post\n";
$ret = $mastodon_api->post_statuses(array('status' => 'Test Auto Post'));
var_dump($ret);
print '</pre>';
Everything works untill it tries to create a toot and it gives the following:-
["html"]=>
array(1) {
["error"]=>
string(27) "The access token is invalid"
}
["response"]=>
array(27) {
["url"]=>
yks118 commented