vanita5 / mastodon-api

Mastodon API Client Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for public API

jaller94 opened this issue · comments

As mentioned in Mastodon’s documentation some API endpoints do not require an authentication. (e.g. statuses/:id)

https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#timelines

If I try to create a Mastodon object without a an access_token I get the following error:

./node_modules/mastodon-api/lib/mastodon.js:345
                    throw new Error('Mastodon config must include \'' + reqKey + '\' when using \'user_auth\'');
                    ^

Error: Mastodon config must include 'access_token' when using 'user_auth'

Is it possible to make unauthorized API calls?

commented

Yes, just pass a dummy-string as access_token: new Mastodon({access_token: 'dummy'})

Ok, in this case I see this issue being done when this note gets added to the documentation (readme).

I will add publicOnly as a config parameter in the next version, which is cleaner than a dummy token.