How to design a RESTful API to check for user's credentials?
rest
Solution
A good approach is to perform a `GET` request for the account/profile info of the current user. and have it return the username, settings, avatar url, etc. `me` is a frequently used as a shorthand identifier of the authenticating user.
GET https://api.example.com/profiles/me
HTTP/1.1 200 OK
{
"username": "bob",
"id": "xyz",
"created_at": 123,
"image_url": "https://example.com/bob.png"
}
Problem
I'm designing an API for a mobile app, and I hope to keep it RESTful. API's are authorized using Basic HTTP Auth, however, When the user open the app for the first time, he need to login first, so I need to design an API to check for user's credentials, which will accept a pair of username and password, return success or fail accordingly. the problem is what the url should be so it is restful? I don't think /login is a good one.