This project is a simple authentication flow implemented in Golang, demonstrating user signup, login, and OTP-based verification using in-memory storage.
go run .The server starts on http://localhost:8080 and maintains user data in memory for the duration of its execution.
POST /signup
Request
{
"name": "cheems",
"password": "cheems@123"
}Response
{
"name": "cheems",
"password": "JDJhJDEwJHQ3OGFsNUdLODhLTzVHQ0g0djFWOC43bFF3cm9PRTlvUnZXalZieXRyVWtOUFlSVEhuME5p"
}POST /login
Request
{
"name": "cheems",
"password": "cheems@123"
}Response
{
"message": "User Logged in Successfully!"
}During login, a One-Time Password (OTP) is generated and logged to the server console. This OTP is required for the next step.
POST /otp
Request
{
"otp": "467448"
}Response
{
"message": "Welcome to Nirvana"
}- User data is stored in memory while the server is running.
- Passwords are securely hashed before storage.
- Accurate HTTP status codes are returned for all responses.
- Responses are properly encapsulated and structured.