mirror of https://github.com/tootsuite/mastodon
Initial Home page
commit
6dca01f9bf
|
@ -0,0 +1,11 @@
|
|||
Mastodon builds around the idea of being a server first, rather than a client itself. Similarly to how a XMPP chat server communicates with others and with its own clients, Mastodon takes care of federation to other networks, like other Mastodon or GNU Social instances. So Mastodon provides a REST API, and a 3rd-party app system for using it via OAuth2.
|
||||
|
||||
Once logged in on Mastodon, you can go to Authorized Apps -> Register new app here. You can create a new OAuth application, and once you do so, you will get a Client ID and a Client Secret. You can use those with an OAuth client library of your choice, but in this example we want to just use the API over cURL.
|
||||
|
||||
From these two, you will need to acquire an access token. It is possible to do using your account's e-mail and password like this:
|
||||
|
||||
curl -X POST -d "client_id=CLIENT_ID_HEREclient_secret=CLIENT_SECRET_HERE&grant_type=password&username=YOUR_EMAIL&password=YOUR_PASSWORD" -Ss https://mastodon.social/oauth/token
|
||||
|
||||
The response will be a JSON object containing the key `access_token`. Use that token in any API requests by setting a header like this:
|
||||
|
||||
curl --header "Authorization: Bearer ACCESS_TOKEN_HERE" -sS https://mastodon.social/api/statuses/home
|
Loading…
Reference in New Issue