Codepeak 2021 Open source
A secure-authentication system which verifies users by verifying an uploaded file.
-
For registering a new user
-
URL
POST /api/register
-
Request body structure
Parameter Type Required Description name
string
Required Your Name email
string
Required Your Email password
string
Required Your password age
string
Required Your Age phoneno
string
Required Your Phone Number -
Example Input
{ "name" : "demo", "email" : "[email protected]", "password" : "demo@123", "age" : 19, "phoneno" : 9999999999 }
-
Example Response on success
{ "serializer" : { "name" : "demo", "email" : "[email protected]", "password" : "demo@123", "age" : 19, "phoneno" : 9999999999 } "status" : 201, "message" : "User Created Successfull" }
-
Example Response on using registered email
{ "email" : [ "user with this email already exists" ] }
-
For logging in a user
-
URL
POST /api/login
-
Request body structure
Parameter Type Required Description email
string
Required Your Email password
string
Required Your password -
Example Input
{ "email" : "[email protected]", "password" : "demo@123", }
-
Example Response on success
{ "message" : "Successfully logged in", "status" : 200 }
-
Example Response on Wrong Password
{ "message" : "You have Entered Incorrect Password", "status" : 403 }
-
Example Response on Wrong Email
{ "message" : "No User found", "status" : 403 }
-
Remarks:
- jwt token is saved in Cookies and sent to server on every request
- if the token expires/is_invalid, then we have to login again
-
For getting user data
-
URL
GET /api/user
-
Request body structure
Parameter Type Required Description none
none
none -
Example Input
{}
-
Example Response on success
{ "message" : { "id" : 1, "name" : "demo", "email" : "[email protected]", "age" : 19, "phoneno" : 9999999999 }, "status" : 200 }
-
Remarks:
- server send your user details by analysing your jwt token which is automatically send in cookies
-
For updating user data
-
URL
POST /api/profile
-
Request body structure
Parameter Type Required Description name
string
Not Required Your Name age
string
Not Required Your Age phoneno
string
Not Required Your Phone Number -
Example Input
{ "name" : "demo updated", "age" : 20, }
-
Example Response on success
{ "message": "Your Profile Updated Successfully", "status":200 }
-
For Signing out the current logged in user
-
URL
POST /api/logout
-
Request body structure
Parameter Type Required Description none
none
none -
Example Input
{}
-
Example Response on success
{ "message" : "success" }
-
Remarks:
- on logout, the jwt token is deleted from Cookies.
-
For Uploading the images
-
URL
POST /api/upload
-
Request body structure
Parameter Type Required Description user
int
Required user id title
string
Required image name image
image
Required image to be uploaded -
Example Input and Response
-
For Listing all the images
-
URL
GET /api/listview
-
Request body structure
Parameter Type Required Description none
none
none -
Example Input and Response
-
For Deleting the images
-
URL
POST /api/deleteimage
-
Request body structure
Parameter Type Required Description id
int
Required id of image image
string
Required id of image -
Example Response on mismatch of user & image relation
{ "message":"Can't delete other user's image" }