Home
  • 한국어
  • ENGLISH
Home
  • 한국어
  • ENGLISH
  • API Guide
  • Withnox & Addnox

    • Introduction
    • Authentication
    • User
    • Analysis & History
  • LUX

    • Introduction
    • Authentication
    • Device
    • User

Authentication

This page describes the APIs related to authentication for the LUX project.

Introduction

The LUX Authentication API provides functions to perform authentication-related tasks such as user registration (sign-up), social media sign-up, login, and SMS number verification.

Authentication

Some authentication APIs require an authentication token. Please include the authentication token in the Authorization header to make authenticated API requests.

Authorization: Bearer your_token_here

Replace your_token_here with the access token obtained during the authentication process.

Endpoints

Signin

This API allows a user to log in with the provided email and password.

POST /api/v1/lux/auth/email/signin

Body Parameters

NameTypedescription
username requiredstringEmail value
password requiredstringPassword value

Request Example

POST /api/v1/lux/auth/email/signin
Content-Type: application/x-www-form-urlencoded
{
  "username ": "string",
  "password ": "string"
}

Response Example

200 OK

If the login is successful, the API provides an access_token and a refresh_token. Use access_token for API calls. The refresh_token is used to renew the access_token upon expiration.

{
  "access_token": "string",
  "expires_in": 0,
  "refresh_token": "string",
  "refresh_expires_in": 0,
  "id": 0,
  "token_type": "string"
}
ERROR

Error Response

Provides API status codes and messages based on the HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400Password is invalidIncorrect password.
401Sign-up not completedSign-up is not completed.
403SMS verification requiredSMS verification is not completed.
404User not foundUser could not be found.
410User is DeletedAccount has been deleted.
423Access denied. Account blockedAccount has been blocked.
{
    "detail": "Password is invalid"
}

Token Refresh

This is an API that reissues a token using a refresh_token. If the user information in the refresh_token matches, but the token itself does not match the refresh_token stored in the DB (database), it is considered a duplicate login, and the refresh_token in the DB is deleted. On the front-end, a "401 Refresh token is not valid" error should be handled by branching to a logout process.

POST /api/v1/lux/auth/refresh-token

Body Parameters

NameTypedescription
refresh_token requiredstringOriginal Refresh Token

Request Example

POST /api/v1/lux/auth/refresh-token
Content-Type: application/json
{
  "refresh_token": "string"
}

Response Example

200 OK
{
    "access_token": "access_token",
    "expires_in": 900, // 15 minutes 
    "refresh_token": "new_refresh_token",
    "refresh_expires_in": 1209600,  // 2 weeks
    "id": "uuid",
    "token_type": "bearer",
}
ERROR

Error Response

Provides API status codes and messages based on the HTTP status code. Refer to the table below.

HTTP status codedetaildescription
401Token is expiredrefresh_token is expired, proceed logout process.
401Could not validate credentialswrong refresh_token, proceed logout process.
401Refresh token is not validConsidered a duplicate login, proceed logout process.
{
    "detail": "Refresh token is not valid"
}

Send SMS Verification Message

This API sends an SMS verification message to the provided phone number. It is used not only for signup but also to help users retrieve lost accounts.

POST /api/v1/lux/auth/send-sms-auth

Body Parameters

NameTypedescription
phone requiredstringPhone number to send the verification message(E.164 format)
- ex: +1012345678

Request Example

POST /api/v1/lux/auth/send-sms-auth
Content-Type: application/json
{
  "phone": "+1012345678"
}

Response Example

200 OK

If the SMS verification message is successfully sent, it returns a true.

  true
ERROR

Error Response

Provides API status codes and messages based on the HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400Phone number is invalidPhone number format is invalid
409Phone number is already registeredThis phone number is already registered
409Failed to send SMSSend sms message with Twillo service has failed
{
  "detail": "Phone number is invalid"
}

Verify SMS Verification Code

This API verifies the SMS verification code sent to the user's phone number.

POST /api/v1/lux/auth/phone-number-validation

Body Parameters

NameTypedescription
phone requiredstringPhone number to send the verification message(E.164 format)
- ex: +14155552671
validnum requiredstring6-digit verification code received via SMS

Request Example

POST /api/v1/lux/auth/phone-number-validation
Content-Type: application/json
{
  "phone": "+1012345678",
  "validnum": "123456"
}

Response Example

200 OK

If the SMS verification code is successfully verified, it returns valid_token. When calling the signup, include the valid_token in the Authorization header.

{
  "valid_token": "string"
}
ERROR

Error Response

Provides API status codes and messages based on the HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400Validation code is expiredThe code has expired.
400Validation code is invalidThe code provided is invalid.
403User previously deletedAccount has been deleted.
409Phone number is already registeredAlready signed up phone number.
{
  "detail": "Validation code is expired"
}

Email Signup

This API allows a user to complete the signup process with an email and password. Include the access_token in the Authorization header for authentication.

POST /api/v1/lux/auth/email/signup

Headers

NameTypedescription
Authorization requiredBearervalid_token

Body Parameters

NameTypedescription
email requiredstringEmail address
password requiredstringPassword value.
first_name requiredstringUser's Fullname
last_name requiredstringDepreacted, please send empty string
birthdate requiredstringUser's birthdate in the format(yyyymmdd)
- ex : 19970101
gender requiredstringUser's gender
- M : Male
- F : Female
- P : Prefer Not to Say
phone requiredstringPhone number in E.164 format
- ex: +14155552671
register_type requiredstringRegistration type
- E : Email
- S : Social
is_push_agree requiredbooleanWhether the user agrees to receive push notifications
is_marketing_agree requiredbooleanWhether the user agrees to receive marketing communications
national_code requiredstringCountry code ISO 3166-1 alpha-2

Request Example

POST /api/v1/lux/auth/email/signup
Authorization: Bearer valid_token_here
Content-Type: application/json
{
  "email": "string",
  "password": "string",
  "first_name": "string",
  "last_name": "",
  "birthdate": "string",
  "gender": "string",
  "phone": "string",
  "register_type": "string",
  "is_push_agree": true,
  "is_marketing_agree": true,
  "national_code": "string"
}

Response Example

200 OK

If the signup is successful, it returns an access_token and refresh_token, similar to a login response.

{
  "access_token": "string",
  "expires_in": 0,
  "refresh_token": "string",
  "refresh_expires_in": 0,
  "id": 0,
  "token_type": "string"
}
ERROR

Error Response

Provides API status codes and messages based on the HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400Email is not validInvalid email format
401Token is invalidInvalid auth token
409Same email is already registeredAlready registered email.
500Failed to sign up userPlease contact server admin.
{
  "detail": "Email is not valid"
}

Password Reset

This API allows a user to reset their password using their email.

POST /api/v1/lux/auth/send-reset-mail

Body Parameters

NameTypedescription
email requiredstringEmail address

Request Example

POST /api/v1/lux/auth/phone-number-validation
Content-Type: application/json
{
  "email": "string"
}

Response Example

200 OK
{
  "statusCode": 200,
  "message": "User reset password email send successfully"
}
ERROR

Error Response

Provides API status codes and messages based on the HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400User signed up using a social accountThis email is signed up with social account
404User ID not foundNo account is associated with the provided email
500Email send failedFailed to send email
{
  "detail": "User id is not found"
}

Account Recovery (Find Account)

This API allows a user to retrieve their account ID (email) using their registered phone number and a verification code sent via SMS.

POST /api/v1/lux/auth/find-id-by-phone

Body Parameters

NameTypedescription
phone requiredstringPhone number in E.164 format
- ex: +14155552671
validnum requiredstring6-digit verification code received via SMS

Request Example

POST /api/v1/lux/auth/phone-number-validation
Content-Type: application/json
{
  "phone": "string",
  "validnum": "string"
}

Response Example

200 OK
{
  "email": "your@email.com",
  "provider": "naver"
}
ERROR

Error Response

Provides API status codes and messages based on the HTTP status code. Refer to the table below.

HTTP status codedetaildescription
400Validation code is expiredThe provided code is expired
400Validation code is invalidThe provided code is invalid
403User previously deletedAccount has been deleted.
404User id is not foundCan not find related account info
{
  "detail": "Validation code is expired"
}

Common Error Handling

These are error codes that are commonly returned by all endpoints.

Error Response Example

  • 401 Unauthorized: The token is invalid.
    {
      "detail": "Could not validate credentials" // The token is invalid
    }
    
  • 401 Unauthorized: The token has expired.
    {
      "detail": "Token is expired" // The token has expired.
    }
    
  • 404 Not Found: The resource cannot be found. Please check the URI again.
    {
      "detail": "Resource not found"
    }
    
  • 500 Internal Server Error: This is a server error.
    {
      "detail": "Internal server error. Please try again later."
    }
    
Last Updated:: 5/20/25, 6:38 AM
Contributors: Jeongtae Kim
Prev
Introduction
Next
Device