Email and password based authentication
Authenticate users with their email addresses and passwords. This is the most common authentication method for web applications. It is also the most secure method of authentication, as it does not require you to store any sensitive information on the client side.
Note that both Login and Register endpoint will return a verification token. This token is used to verify the user's login along with correct OTP Code with the Verify OTP endpoint.
Register
This endpoint allows you to register your users with email and password.
Required attributes
- Name
email
- Type
- string
- Description
The email address of the user.
- Name
password
- Type
- string
- Description
The desired password of the user.
- Name
fullName
- Type
- string
- Description
Users full name
Optional attributes
- Name
nationalID
- Type
- string
- Description
The national ID of users, it is also possible to be filled with Passport ID
- Name
country
- Type
- string
- Description
Country of users, i.e "Singapore"
- Name
countryCode
- Type
- string
- Description
Country Codem i.e "SG"
Request
curl -X POST https://sandbox.rampable.co/v1/auth/register \
-H 'Content-Type: application/json' \
-d '{
"fullName": "John Doe",
"nationalID": "123123",
"countryCode": "SG",
"country": "Singapore",
"password": "test123",
"email": "test@test.com"
}'
Response
{
"statusCode": 200,
"message": "User Created",
"data": {
"verificationToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVC...."
}
}
Login
This endpoint allows you to authenticate a user with email and password.
Required attributes
- Name
email
- Type
- string
- Description
The email address of the user.
- Name
password
- Type
- string
- Description
The password of the user.
Request
curl -X POST https://sandbox.rampable.co/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{
"email": "sample@mail.com"
"password": "secret-password"
}'
Response
{
"status": 200,
"message": "ok",
"data": {
"verificationToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVC...."
}
}
Verify OTP
This endpoint allows you to verify a user's login with a verification token.
Required attributes
- Name
verificationToken
- Type
- string
- Description
The verification token returned from the login endpoint.
- Name
otp
- Type
- string
- Description
The one-time password sent to the user's email address.
- Name
isDisableExpire
- Type
- boolean
- Description
This will define if the authentication token generated will use expiry or not. When sets to true, the generated token wont have expiry.
⚠️Please use
isDisableExpire
property with caution. When the value istrue
, it means the token wont be able to invalidated after issued.Optional, The default value is
false
.
Request
curl -X POST https://sandbox.rampable.co/v1/auth/verify-login \
-H 'Content-Type: application/json' \
-d '{
"verificationToken": "eyJhbGciOiJIUz...."
"otp": "123456"
}'
Response
{
"status": 200,
"message": "ok",
"data": {
"accessToken": "eyJhbGciOiJSUzI1NiIsI....",
"user": {
"name": "XXXXXX",
"policy": "648bcfbf0a0e235ee4cd2afe",
"email": "sample@mail.com",
"organizationId": {
"_id": "648ad7c3f7ef099b9b86c236",
"orgName": "XXXXXX"
},
"role": "admin",
"is_active": true,
"invitation_date": "2023-07-17T09:48:39.814Z",
"iskyc": false,
"createdAt": "2023-07-17T09:48:39.816Z",
"updatedAt": "2023-10-01T00:35:39.189Z",
"invitation_expiration_date": "2023-07-18T09:48:39.906Z",
"country": "Indonesia",
"countryCode": "ID",
"kyc_url": "https://sandbox-buy.transfi.com/sell/headless/initiate-kyc?token=U2FsdGVkX1",
"legalFullName": "XXXXXX",
"transfiId": "UX-12345",
"otp_code": "123456",
"credentials": {},
"id": "64b50e77f6f117e759c15783"
}
}
}