1
0
mirror of https://github.com/mastodon/mastodon synced 2024-12-29 22:18:13 +09:00
mastodon/docs/Using-the-API/Tips-for-app-developers.md

17 lines
1.5 KiB
Markdown
Raw Normal View History

2017-01-22 06:53:02 +09:00
Tips for app developers
=======================
## Authentication
2017-01-22 06:49:08 +09:00
Make sure that you allow your users to specify the domain they want to connect to before login. Use that domain to acquire a client id/secret for OAuth2 and then proceed with normal OAuth2 also using that domain to build the URLs.
In my opinion it is easier for people to understand what is being asked of them if you ask for a `username@domain` type input, since it looks like an e-mail address. Though the username part is not required for anything in the OAuth2 process. Once the user is logged in, you get information about the logged in user from `/api/v1/accounts/verify_credentials`
2017-01-22 06:53:02 +09:00
## Usernames
2017-01-22 06:49:08 +09:00
Make sure that you make it possible to see the `acct` of any user in your app (since it includes the domain part for remote users), people must be able to tell apart users from different domains with the same username.
2017-01-22 06:53:02 +09:00
## Formatting
2017-01-22 06:49:08 +09:00
2017-01-22 06:53:02 +09:00
The API delivers already formatted HTML to your app. This isn't ideal since not all apps are based on HTML, but this is not fixable as its part of the way OStatus federation works. Most importantly, you get some information on linked entities alongside the HTML of the status body. For example, you get a list of mentioned users, and a list of media attachments, and a list of hashtags. It is possible to convert the HTML to whatever you need in your app by parsing the HTML tags and matching their `href`s to the linked entities. If a match cannot be found, the link must stay a clickable link.