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

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

    • Introduction
    • Authentication
    • Device
    • User

Authentication

This page describes the authentication APIs for the Withnox & Addnox projects.

Introduction

The Withnox & Addnox Authentication API provides functionalities for user registration, social registration, login, and SMS number verification.

If you need some imagination of API Flow please checkout the Figma API Flow!

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

Check Registration Status

This API checks if a user is registered with the given email.

GET /api/v1/addnox/auth/sign-in/check/{email}

Parameters:

NameTypeDescription
email requiredstringEmail value

Request Example

GET /api/v1/addnox/auth/sign-in/check/test@gmail.com

Response Example

200 OK

If the user is already registered, a 200 OK response is returned, indicating that the user can proceed to login.

{
  "message": "User already signed up please login"
}
ERROR

Error Response

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

HTTP status codedetaildescription
404User not foundNo registered user found for this email.
{
    "detail": "User not found"
}

Pre-Signup

This API pre-registers a user with the provided email and password.

Endpoint

POST /api/v1/addnox/auth/email/pre-signup

Body Parameters

NameTypeDescription
emailstringRequired. Email value.
passwordstringRequired. Password value.

Request Example

POST /api/v1/addnox/auth/email/pre-signup
Content-Type: application/json

{
  "email": "string",
  "password": "string"
}

Response Example

200 OK

If the pre-signup is successful, it returns a pre-generated email_user_id. Save this value for use in the signup API.

{
  "email_user_id": 0,
  "email": "string"
}
ERROR

Error Response

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

HTTP status codedetaildescription
409Same email already registeredEmail already registered
{
    "detail": "Same email already registered"
}

Login

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

Endpoint

POST /api/v1/addnox/auth/email/signin

Body Parameters

NameTypeDescription
usernamestringRequired. Email value.
passwordstringRequired. Password value.

Request Example

POST /api/v1/addnox/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.
{
    "detail": "Password is invalid"
}

Email ID Lookup

This API retrieves the user ID associated with the provided email address. When Login returns 401 ERROR that user signup is not complete, you need to call this API to retreives email_user_id for signup API.

POST /api/v1/addnox/auth/email/get-id/{email}

Parameters:

NameTypedescription
email requiredstringEmail address to look up

Request Example

POST /api/v1/addnox/auth/email/get-id/test@gmail.com

Response Example

200 OK
{
  "email_user_id": 0
}
ERROR

Error Response

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

HTTP status codedetaildescription
404Failed to get user idNo such user that has presigned up with this email
{
  "detail": "Failed to get user id"
}

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/addnox/auth/send-sms-auth

Body Parameters

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

Request Example

POST /api/v1/addnox/auth/send-sms-auth
Content-Type: application/json
{
  "phone": "string"
}

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/addnox/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/addnox/auth/phone-number-validation
Content-Type: application/json
{
  "phone": "string",
  "validnum": "string"
}

Response Example

200 OK

If the SMS verification code is successfully verified, it returns valid_token. When calling the signup and social 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. Please request a new one
400Validation code is invalidThe code provided is invalid
{
  "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. email_user_id value can obtained from pre-signup or get-id.

POST /api/v1/addnox/auth/email/signup

Headers

NameTypedescription
Authorization requiredBearervalid_token

Body Parameters

NameTypedescription
email requiredstringEmail address
email_user_id requiredintegerpre-sign up user's id
first_name requiredstringUser's first name
last_name requiredstringUser's last name
birthdate requiredstringUser's birthdate in the format(yyyymmdd)
- ex : 19970101
gender requiredstringUser's gender
- M : Male
- F : Femal
- N : Non-Binary
- 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
- WITHNOX : KR
- ADDNOX : ISO code (2)

Request Example

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

Response Example

201 Created

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
401Not authenticatedvalid_token is missing or invalid.
404User not foundNo presigned up user found
500Failed to sign up userSome required fields are missing or incorrectly formatted.
{
  "detail": "User not found"
}

Password Reset

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

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

Body Parameters

NameTypedescription
email requiredstringEmail address

Request Example

POST /api/v1/addnox/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
404User id is 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/addnox/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/addnox/auth/phone-number-validation
Content-Type: application/json
{
  "phone": "string",
  "validnum": "string"
}

Response Example

200 OK
{
  "email": "your@email.com"
}
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
{
  "detail": "Validation code is expired"
}

Social Login

This API enables social login with a specified social provider. You need to pass the provider as a parameter, and only one of the two token parameters is required depending on the provider.

POST /api/v1/addnox/auth/social-signin/{provider}

Parameters

NameTypedescription
provider requiredstringSocial provider
- apple
- google
- facebook
- naver
- kakao

Body Parameters

NameTypedescription
id_token optionalstringIt is essential if provider is google, apple, naver, kakao.
access_token optionalstringIt is essential if provider is facebook.

Request Example

POST /api/v1/addnox/auth/social-signin/google
Content-Type: application/json
{
  "id_token": "string",
  "access_token": "string"
}

Response Example

200 OK

If the social login is successful, the API returns an access_token and refresh_token.

{
  "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
403User is not valid, please sign upUser has not completed social sign-up. Redirect to social sign-up
400User is signed up with email typeUser has sign up with email type
404User is signed up with {social_type} typeUser has sign up with other social provider
409Invalid {provider} access tokenThe provided token is invalid or expired.
{
  "detail": "User is not valid, please sign up"
}

Social Sign-Up

This API allows a user to complete social sign-up using their social account information. Similar to the standard email sign-up, an SMS-verified valid_token is required for verification.

POST /api/v1/addnox/auth/social/signup

Headers

NameTypedescription
Authorization requiredBearervalid_token

Body Parameters

NameTypedescription
email requiredstringEmail address.
first_name requiredstringUser's first name
last_name requiredstringUser's last name
birthdate requiredstringUser's birthdate in the format(yyyymmdd)
- ex : 19970101
gender requiredstringUser's gender
- M : Male
- F : Femal
- N : Non-Binary
- P : Prefer Not to Say
phone requiredstringPhone number in E.164 format
- ex: +14155552671
register_type requiredstringRegistration type
- E : Email
- S : Social
social_id requiredstringPlease send social_token refer to provider
- id_token : If provider is google, apple, naver, kakao
- access_token : If provider is facebook
social_type requiredstringSocial provider value
- google
- apple
- facebook
- naver
- kakao
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
- WITHNOX : KR
- ADDNOX : ISO code (2)

Request Example

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

Response Example

200 OK

If the social sign-up 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
401Not authenticatedThe valid_token is invalid or expired
{
  "detail": "Not authenticated"
}
Last Updated:: 11/7/24, 5:02 AM
Contributors: Jeongtae Kim
Prev
Introduction
Next
User