Add authentication info to README

This commit is contained in:
Tanner Collin 2018-09-15 21:25:39 -06:00
parent 28533e0300
commit 8c6a4dcbe6

View File

@ -15,7 +15,29 @@ $ . env/bin/activate
## API
The API is RESTful and returns hyperlinked json data. URLs require a trailing slash.
The API is RESTful and returns hyperlinked json data. **URLs require a trailing slash.**
### Authentication
Authentication is token-based and done against the Protospace member portal. Upon successful login, the auth server will automatically register the user and create them a profile.
#### POST `/login/`
POST data `username` and `password`. Upon successful login, a 200 status and a token will be returned.
Example response:
```
{
"token": "9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"
}
```
In subsequent requests, the token key should be included in the `Authorization` HTTP header. The key should be prefixed by the string literal "Token", with whitespace separating the two strings. For example:
```
Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
```
### For anonymous users