User Authentication
The user authentication endpoints provide the following functionalities:
- Register users
- Login users
- Logout users
- Verify authentication
- Reset passwords for users
POST/auth/register
Register
This endpoint allows you to register a new user.
Required attributes
- Name
email
- Type
- string
- Description
The email address of the user.
- Name
password
- Type
- string
- Description
The password of the user.
Request
POST
/auth/registercurl -X POST https://api.puregpu.com/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "test@test.com",
"password": "password"
}'
Response
{
"result": "success",
"message": "Registered successfully"
}
POST/auth/login
Login
This endpoint allows you to login a user.
Required attributes
- Name
email
- Type
- string
- Description
The email address of the user.
- Name
password
- Type
- string
- Description
The password of the user.
Request
POST
/auth/logincurl -X POST https://api.puregpu.com/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@test.com",
"password": "password"
}'
Response
{
"result": "success",
"message": "Logged in successfully"
}
POST/auth/logout
Logout
This endpoint allows you to logout a user.
Request
POST
/auth/logoutcurl -X POST https://api.puregpu.com/auth/logout \
-H "Content-Type: application/json" \
-d '{}'
Response
{
"result": "success",
"message": "Logged out successfully"
}
GET/auth/check
Auth Check
This endpoint allows you to check if a user is authenticated.
Request
GET
/auth/logoutcurl https://api.puregpu.com/auth/check
Response
{
"result": "success",
"user": {
"email": "test@test.com",
"whmcs_client_id": "104"
}
}
POST/auth/reset-password
Request Password Reset
This endpoint allows you to request a password reset for a user. This will send an email to the user with a link to reset their password.
Required attributes
- Name
email
- Type
- string
- Description
The email address of the user.
Request
GET
/auth/logoutcurl -X POST https://api.puregpu.com/auth/reset-password \
-H "Content-Type: application/json" \
-d '{
"email": "test@test.com"
}'
Response
{
"result": "success",
"message": "Password reset email sent"
}
POST/auth/reset-password/:token
Reset Password
This endpoint allows you to reset the password for a user using a token that was sent to the user's email.
Required attributes
- Name
newPassword
- Type
- string
- Description
The new password for the user.
Request
GET
/auth/logoutcurl -X POST https://api.puregpu.com/auth/reset-password/52d43584122df4f7efcad25ebabe60c48b75a79c \
-H "Content-Type: application/json" \
-d '{
"newPassword": "newpassword"
}'
Response
{
"result": "success",
"message": "Password has been reset"
}