Authentication
To authenticate user from our API follow the endpoints above.
Register
- POST:
/v1/auth/register
Sign up a new user
Params:
-
first_name
: User first name (string) -
last_name
: User last name (string) -
email
: User e-mail (string) -
username
: Username (indentifier) (string) -
password
: User password (string) -
phone
: User phone number (number) [optional] -
bio
: User biography (longtext) [optional] -
birthdate
: User birthdate (date, format:Y-m-d
)
Output
{
"data":
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC92MS9hdXRoL3JlZ2lzdGVyIiwiaWF0IjoxNTA2NDI3MTIxLCJleHAiOjE1MDY0MzA3MjEsIm5iZiI6MTUwNjQyNzEyMSwianRpIjoiWFc2SXRpRGhHUDhqbGJvciJ9.4aBnEQ-rxqlkDy2PcRPaPvOol_TSQCHNx1hut8OcBRo",
"token_type": "Bearer"
}
}
Login
- POST:
/v1/auth/login
Create the Authorization token
Params:
-
email
- The user email (type: string) -
password
User password (type: string)
Example:
curl -X POST \
https://doesangueapi.herokuapp.com/v1/auth/login \
-H "Content-Type:application/json" \
-F email=USER_EMAIL \
-F password=USER_PASSWORD
- Output
{
"data": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC92MS9hdXRoL2xvZ2luIiwiaWF0IjoxNTA2NDIyOTEwLCJleHAiOjE1MDY0MjY1MTAsIm5iZiI6MTUwNjQyMjkxMCwianRpIjoiMDlESU81aTVVcFY1RnQ5eSJ9.Zv9Fl1CMgObNdVqFYU231umygPNGhkB4SIKkKVOOGBE",
"token_type": "bearer"
}
}
User Information
- GET:
/v1/auth/me
Check who are you (authenticated User)
Params:
- Header
"Content-Type: application/json"
- Type/structure of data you are sending"Authorization: Bearer token"
- Authentication token
Example:
curl -X POST \
https://doesangueapi.herokuapp.com/v1/auth/me \
-H "Content-Type:application/json" \
-H "Authorization: Bearer YOUR_LONG_TOKEN"
- Output
{
"data": {
"first_name": "Test",
"last_name": "User",
"username": "testuser"
}
}