Amida Auth
This is an API allowing authentication and basic authorization using JSON Web Tokens.
Miscellaneous ¶
Resources related to utility actions, such as health checks.
Users ¶
Resources related to User identity management, such as creating and updating Users. This includes editing user scopes for authorization purposes.
Users Collection ¶
List All UsersGET/user
Get a complete list of users. Must be admin.
Example URI
Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTksInVzZXJuYW1lIjoidGVzdDEyMyIsImVtYWlsIjoidGVzdEBhbWlkYS5jb20iLCJzY29wZXMiOlsiYWRtaW4iXSwiaWF0IjoxNTEyNDk2MDIzLCJleHAiOjE1MTI0OTk2MjN9._zAtHmEDw7AGNMuzo1FOUl_QGhB9g1raNnGG-00ZHmw200Headers
Content-Type: application/json; charset=utf-8Body
[
{
"id": 19,
"username": "test123",
"email": "test@amida.com"
}
]Create New UserPOST/user
Create a single new user by providing username, password, and email info. TODO: should not create scopes by default, this is a security risk.
Example URI
Headers
Content-Type: application/json; charset=utf-8Body
{
"username": "test123",
"email": "test@amida.com",
"password": "testpass",
"scopes": [
"admin"
]
}200Headers
Content-Type: application/json; charset=utf-8Body
{
"id": 17,
"username": "test123",
"email": "test@amida.com",
"scopes": [
"admin"
]
}Single User Actions ¶
Get Single UserGET/user/:userId
Get a single user by ID. Must be admin.
Example URI
Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTksInVzZXJuYW1lIjoidGVzdDEyMyIsImVtYWlsIjoidGVzdEBhbWlkYS5jb20iLCJzY29wZXMiOlsiYWRtaW4iXSwiaWF0IjoxNTEyNDk2MDIzLCJleHAiOjE1MTI0OTk2MjN9._zAtHmEDw7AGNMuzo1FOUl_QGhB9g1raNnGG-00ZHmw200Headers
Content-Type: application/json; charset=utf-8Body
{
"id": 19,
"username": "test123",
"email": "test@amida.com",
"scopes": [
"admin"
]
}Update UserPUT/user/:userId
Update a single user’s email by ID. Must be admin or the user being updated.
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTksInVzZXJuYW1lIjoidGVzdDEyMyIsImVtYWlsIjoidGVzdEBhbWlkYS5jb20iLCJzY29wZXMiOlsiYWRtaW4iXSwiaWF0IjoxNTEyNDk2MDIzLCJleHAiOjE1MTI0OTk2MjN9._zAtHmEDw7AGNMuzo1FOUl_QGhB9g1raNnGG-00ZHmwBody
{
"email": "new@amida.com"
}200Headers
Content-Type: application/json; charset=utf-8Body
{
"id": 19,
"username": "test123",
"email": "new@amida.com",
"scopes": [
"admin"
]
}Delete UserDELETE/user/:userId
Delete a single user by ID. Must be admin.
Example URI
Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTksInVzZXJuYW1lIjoidGVzdDEyMyIsImVtYWlsIjoidGVzdEBhbWlkYS5jb20iLCJzY29wZXMiOlsiYWRtaW4iXSwiaWF0IjoxNTEyNDk2MDIzLCJleHAiOjE1MTI0OTk2MjN9._zAtHmEDw7AGNMuzo1FOUl_QGhB9g1raNnGG-00ZHmw204User Scopes ¶
Update User ScopesPUT/user/scopes/:userId
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QxMjMiLCJlbWFpbCI6InRlc3RAYW1pZGEuY29tIiwic2NvcGVzIjpbImFkbWluIl0sImlhdCI6MTUwNjUzNDE5NywiZXhwIjoxNTA2NTM3Nzk3fQ.wnjoNrllnvx2EL411bRRMSemPxuNdeq5VXxXjpYl67EBody
{
"scopes": [
"admin",
"new"
]
}200Headers
Content-Type: application/json; charset=utf-8Body
{
"id": 17,
"username": "test123",
"email": "test@amida.com",
"scopes": [
"admin",
"new"
]
}Me ¶
Get Logged-in UserGET/user/me
Get profile info of the logged-in user (i.e. provided JWT).
Example URI
Headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTksInVzZXJuYW1lIjoidGVzdDEyMyIsImVtYWlsIjoidGVzdEBhbWlkYS5jb20iLCJzY29wZXMiOlsiYWRtaW4iXSwiaWF0IjoxNTEyNDk2MDIzLCJleHAiOjE1MTI0OTk2MjN9._zAtHmEDw7AGNMuzo1FOUl_QGhB9g1raNnGG-00ZHmw200Headers
Content-Type: application/json; charset=utf-8Body
{
"id": 19,
"username": "test123",
"email": "test@amida.com",
"scopes": [
"admin"
]
}Auth ¶
Resources related to authentication, such as login and password changes.
Login ¶
Authenticate For JWTPOST/auth/login
Example URI
Headers
Content-Type: application/json; charset=utf-8Body
{
"username": "test123",
"password": "testpass"
}200Headers
Content-Type: application/json; charset=utf-8Body
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QxMjMiLCJlbWFpbCI6InRlc3RAYW1pZGEuY29tIiwic2NvcGVzIjpbImFkbWluIl0sImlhdCI6MTUwNjUzNDE5NywiZXhwIjoxNTA2NTM3Nzk3fQ.wnjoNrllnvx2EL411bRRMSemPxuNdeq5VXxXjpYl67E"
}Update Password ¶
Submit New PasswordPOST/auth/update-password
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QxMjMiLCJlbWFpbCI6InRlc3RAYW1pZGEuY29tIiwic2NvcGVzIjpbImFkbWluIl0sImlhdCI6MTUwNjUzNDYwMywiZXhwIjoxNTA2NTM4MjAzfQ.l0I_BJAdpmaw4EwlZmJzqhC4J6O5mZimRnJ7YB4YI-gBody
{
"password": "newerpass"
}200Headers
Content-Type: text/plain; charset=utf-8Body
OKReset Password Initiation ¶
Submit Reset Password RequestPOST/auth/reset-password
In non-test environments, sends a password reset link to the user’s email.
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QxMjMiLCJlbWFpbCI6InRlc3RAYW1pZGEuY29tIiwic2NvcGVzIjpbImFkbWluIl0sImlhdCI6MTUwNjUzNDYwMywiZXhwIjoxNTA2NTM4MjAzfQ.l0I_BJAdpmaw4EwlZmJzqhC4J6O5mZimRnJ7YB4YI-gBody
{
"email": "test@amida.com"
}200Headers
Content-Type: text/plain; charset=utf-8Body
OKReset Password ¶
Submit New PasswordPOST/auth/reset-password/:token
Should only be executed by clicking the password reset link for non-test environments.
Example URI
Headers
Content-Type: application/json; charset=utf-8Body
{
"password": "newerpass"
}200Headers
Content-Type: text/plain; charset=utf-8Body
OKFacebook Login ¶
OAuth LoginGET/auth/facebook
Example URI
Headers
Content-Type: application/json; charset=utf-8Body
{
"username": "test123",
"password": "testpass"
}302Headers
Location: https://www.facebook.com/dialog/oauth?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A4000%2Fapi%2Fv0%2Fauth%2Ffacebook%2Fcallback&scope=email&client_id=SOMEID