Skip to content

API Documentation

Christo Grabowski edited this page Feb 22, 2023 · 1 revision

User Authentication

Login a user

Logs in a user and returns the user's information

Request

  • Method: Post
  • URL: /api/auth/login
  • Body:
{
  "email": "[email protected]",
  "password": "testpassword"
}

Success Response

  • Status Code: 200
  • Body:
{ 
  "email": "[email protected]", 
  "id": 1, 
  "username": "TestUser" 
}

Error Response: Invalid Credentials

  • Status Code: 401
  • Body:
{ 
  "errors": "Yer kredentials were wrong. Are you a humie spy?" 
}

Error Response: Body Validation Errors

  • Status Code: 401
  • Body:
{ 
  "errors": 
    ["Yer password is required", "Yer email is required"] 
}

Sign Up a New User

Creates a new User and logs them in.

Request

  • Method: POST
  • URL: /api/auth/signup
  • Body:
{ 
  "username": "OrksyUser", 
  "email": "[email protected]", 
  "password": "somePassword" 
}

Success Response

  • Status Code: 200
  • Body:
{ 
  "email": "[email protected]", 
  "id": 1, 
  "username": "OrksyUser" 
}

Error Response: Body Validation Errors

  • Status Code: 401
  • Body:
{ 
  "errors": [ "Username is required", "Email is required" ] 
}