Add an API endpoint to ListenBrainz for validating user tokens
ListenBrainz currently assigns a unique token to each user for authentication purposes. This token is then used by ListenBrainz clients to identify themselves to the ListenBrainz website.
However, there is a chance that the user may have entered an incorrect user token. So, ListenBrainz should have an API endpoint which takes a user token as input and validates it, i.e makes sure that the token is a valid token and that it corresponds to a valid user in the ListenBrainz database.
In order to complete this task, you should
- add a new endpoint to
api.py
that takes a token from a GET request and validates it, sending appropriate JSON responses. - also add a test for this API endpoint in
test_api.py
.
Once completed, submit a pull request with your changes to the Github repository, and respond to any suggestions and requests by the ListenBrainz developers until the pull request is approved (you do not need to wait until it gets merged).