---
# System prepended metadata

title: API - Auth Module
tags: [api, auth-api]

---

# API - Auth Module
| Document          | Link               |
| ----------------- |:----------------------- |
| PRD       | [Neeed Link to PRD](https://hackmd.io/c/tutorials)|
| TDD | [Link to TDD](https://docs.google.com/document/d/1vudhmiYbHEGXHobJLVO31QPVIbQo5ZeWDOzF5GJL390/edit)|

## User Login at SSC & Sinbad Red using storeCode
> Auth Login Endpoint : POST {{host}}/auth/login

```gherkin
Feature:Auth Login Endpoint
    User can login to Sinbad System by call Auth Login Endpoint
    User can login with valid email account or storeId
 
    @ssc-login @red-login
    Scenario Outline: User call Auth Login Endpoint
        Given User set Basic Auth as <auth>
        And User set x-platform header as <x-platform>
        When User call Auth Login Endpoint
        Then Response Status will be <status_code>
        
            Examples: Auth Login
                |auth       |x-platform|status_code|
                |null       |null      |401        |?400
                |null       |invalid   |401        |?400
                |null       |sc        |401        |?400
                |invalidAuth|null      |401        |?400
                |invalidAuth|invalid   |401        |?400
                |invalidAuth|sc        |401        |
                |validAuth  |null      |500        |?400
                |validAuth  |invalid   |500        |?400
                |validMobile|sc        |404        |
                |validSSC   |mobile    |404        |
                |validMobile|mobile    |201        |
                |validSSC   |sc        |201        |
```

## User Login at Mobile Apps using phoneNumber
> Check Phone Number Endpoint : POST {{host}}/auth/check-phone

```gherkin
Feature:Check Phone Number Endpoint
    User can login from mobile apps using phoneNumber.
    User can login using registered phoneNumber
 
    @white-login @red-login
    Scenario Outline: User call Check phoneNumber Endpoint
        Given User set mobilePhoneNo as <mobilePhoneNo>
        And User set x-platform header as <x-platform>
        When User call Check phoneNumber Endpoint
        Then Response Status will be <status_code>
        
            Examples: Auth Login
                |mobilePhoneNo  |x-platform|status_code|
                |null         |null      |406        |?400
                |null         |invalid   |406        |?400
                |null         |mobile    |406        |?400
                |invalidFormat|null      |500        |?400
                |invalidFormat|invalid   |500        |?400
                |invalidFormat|mobile    |404        |V400
                |unRegistered |null      |500        |?400
                |unRegistered |invalid   |500        |?400
                |unRegistered |mobile    |404        |
                |registered   |null      |500        |?400
                |registered   |invalid   |500        |?400
                |registered   |mobile    |201        |
```
> Validate OTP Endpoint : POST {{host}}/auth/validate-otp
```gherkin
Feature:Validate OTP Code
    User can login from mobile apps using phoneNumber.
    User can login using valid OTP Code
 
    @white-login @red-login
    Scenario Outline: User call Validate OTP Endpoint
        Given User set mobilePhoneNo as <mobilePhoneNo>
        And User set otpCode as <otpCode>
        When User call Validate OTP Endpoint
        Then Response Status will be <status_code>
        
            Examples: Auth Login
                |mobilePhoneNo|otpCode|status_code|
                |null         |null   |406        |?400
                |null         |invalid|406        |?400
                |null         |valid  |406        |?400
                |invalidFormat|null   |406        |?400
                |invalidFormat|invalid|404        |
                |invalidFormat|valid  |404        |
                |unRegistered |null   |406        |?400
                |unRegistered |invalid|404        |
                |unRegistered |valid  |404        |
                |registered   |null   |406        |?400
                |registered   |invalid|404        |
                |registered   |expired|404        |
                |registered   |valid  |201        |
```

###### tags: `api`, `auth-api`