hngprojects / hng_boilerplate_java_web

Apache License 2.0
155 stars 43 forks source link

feat: magic link login #661

Open Ofektom opened 1 month ago

Ofektom commented 1 month ago

Description

Create a backend endpoint that verifies the magic link clicked by the user and logs them into their account. The endpoint should validate the token in the magic link and establish a session if valid.

Acceptance Criteria

How to test

Endpoint

/api/v1/auth/magic-link/login

Request Param

String token

Response Body

{
    "status_code": 200,
    "message": "Login Successful!",
    "access_token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJva3BvaG90QGdtYWlsLmNvbSIsImlhdCI6MTcyNDc0...",
    "data": {
        "user": {
            "id": "be015e9f-ad7d-4e18-bc3c-23c443824e8e",
            "first_name": "No",
            "last_name": "name",
            "email": "blesseddoe@gmail.com",
            "role": null,
            "imr_url": null,
            "organisations": [],
            "created_at": "2024-08-27T08:09:51.76954"
        }
    }
}

Related Issue

This ticket is related the the issue

Ofektom commented 1 month ago

@Am0du please review