REST API (1) ‐ Authentication - najat-mansour/task-go GitHub Wiki

Login

Endpoint

POST /task-go/v1/auth/login

Request Body

{
  "username": "najat-mansour",
  "password": "Najat@Mansour28"
}

Possible Responses

✅ 200 OK

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MDM3MjkzNzIsImV4cCI6MTcwMzczNjU3Mn0.oU3fsini19DS_BKpJ_4LZ3xENPiL4rMSrYCdJCQ1C04"
}

⚠️ 400 Bad Request

{
  "error": "Invalid username or password."
}

Email Verification

Endpoint

GET /task-go/v1/auth/email-verification/{email}

Path Parameters

Parameter Type Description
email string The email of the user.

Possible Responses

✅ 200 OK

{
  "code": "1234"
}

⚠️ 400 Bad Request

{
  "error": "Email address not found."
}

Forgot Password

Endpoint

GET /task-go/v1/auth/new-password/{username}

Path Parameters

Parameter Type Description
username string The username of the user.

Possible Responses

✅ 200 OK

{
  "message": "Password reset instructions sent to the user's email."
}

⚠️ 400 Bad Request

{
  "error": "Invalid or missing username."
}

❌ 404 Not Found

{
  "error": "User not found with this username."
}
⚠️ **GitHub.com Fallback** ⚠️