Skip to content

Authentication

sadhasivam edited this page Sep 10, 2024 · 1 revision

Login

URL: /api/login

Method: POST

Description: This API endpoint handles user login, including CAPTCHA validation, throttling, and two-factor authentication if enabled.

Parameters

Parameter Type Required/Optional Description
client_email String Required The email address of the client.
client_password String Required The password of the client.
g-recaptcha-response String Optional (Required if RECAPTCHA_SITE_KEY is set) CAPTCHA response token for validation.

Response

{
    "success": true,
    "message": "You have logged in successfully to Auto Faveo Licenser",
    "data": {
        "token": "<access_token>",
        "user": {
            "id": 1,
            "email": "user@example.com",
            "name": "John Doe"
        }
    }
}

Logout

URL: /api/admin/logout/{user_id}

Method: POST

Description: This API endpoint revokes the OAuth access tokens for a specified user and marks them as expired.

Parameters

Parameter Type Required/Optional Description
user_id Integer Required The unique identifier of the user

Response

{
    "success": true,
    "message": "You have has logged out successfully from Auto Faveo Licenser",
    "data": 1,
}

Forgot Password

URL: /api/forgot

Method: POST

Description: This API endpoint handles the password reset request by validating the provided email, checking rate limits, generating a reset token, and sending a reset email if the email is associated with a user.

Parameters

Parameter Type Required/Optional Description
admin_email String Required The email address of the user requesting a password reset.
g-recaptcha-response String Optional (Required if RECAPTCHA_SITE_KEY is set) CAPTCHA response token for validation.

Response

{
    "success": true,
    "message": "Password reset link has been sent to this email",
    "data": "",
}

Reset Password

URL: /api/reset

Method: POST

Description: This API endpoint allows users to reset their password using a provided reset token. It validates the password, token, and CAPTCHA response, then updates the user's password and removes the reset token.

Parameters

Parameter Type Required/Optional Description
password String Required The new password for the user. Must be at least 8 characters long, contain at least one lowercase letter, one uppercase letter, one digit, and one special character.
password_confirmation String Required Confirmation of the new password. Must match the password field.
token String Required The password reset token received via email.
g-recaptcha-response String Optional (Required if RECAPTCHA_SITE_KEY is set) CAPTCHA response token for validation.

Response

{
    "success": true,
    "message": "Your password has been reset!",
    "data": 1
}

Debugger Settings

URL: /api/save-debug-value

Method: POST

Description: Updates the debugger settings for the application. This endpoint toggles debugging mode, updates the .env file, and manages caching based on the provided settings.

Parameters

Parameter Type Required/Optional Description
debug Boolean Optional Indicates whether to enable or disable debugging. Defaults to false if not provided.
user_id String Required The unique identifier of the user for whom the debug token should be cached.
Authorization String Required Bearer token for authorization. Must be included in the request headers.

Response

{
    "success": true,
    "message": "Value has been updated successfully",
    "data": {
        "debug": true,
        "app_url": "http://example.com"
    }
}

Get reCAPTCHA Status

URL: /api/recaptchaStatus

Method: GET

Description: Retrieves the current status of reCAPTCHA integration and provides the reCAPTCHA site key if configured.

Parameters

This endpoint does not require any parameters.

Response

{
    "recaptcha_status": 1,
    "site_key": "kjwbf768763hhjaasbuii37812yhk"
}

Verify Recovery Code

URL: /api/verify-recovery-code

Method: POST

Description: Verifies a recovery code for user authentication and logs the user in if the code is valid.

Parameters

Parameter Type Required/Optional Description
recovery_code string Required The recovery code used for authentication.
g-recaptcha-response string Optional (Required if RECAPTCHA_SITE_KEY is set) The reCAPTCHA response used for verification.
PPAuth array Required Contains authentication details where the key is used to retrieve session data.

Response

{
    "success": true,
    "message": "You have logged in successfully to Auto Faveo Licenser",
    "data": {
        "token": "<access_token>",
        "user": {
            "id": 1,
            "email": "user@example.com",
            "name": "John Doe"
        }
    }
}

Verify 2FA

URL: /api/verify2fa

Method: POST

Description: Verifies the Two-Factor Authentication (2FA) code for a user and logs them in if the code is valid.

Parameters

Parameter Type Required/Optional Description
totp string Required The One-Time Password (OTP) generated by the user's 2FA application.
g-recaptcha-response string Optional (Required if RECAPTCHA_SITE_KEY is set) The reCAPTCHA response used for verification.
PPAuth array Required Contains authentication details where the key is used to retrieve session data.

Response

{
    "success": true,
    "message": "You have logged in successfully to Auto Faveo Licenser",
    "data": {
        "token": "<access_token>",
        "user": {
            "id": 1,
            "email": "user@example.com",
            "name": "John Doe"
        }
    }
}

Clone this wiki locally