Authorized uses are users that have been given the permission to access select features like signing in with magic link. The permissions are handled in the back office.
When a user clicks on the button to login with magic link:
Make a call to the backend to check if the user is an authorized user
If user is authorized, a token will be returned
If user is NOT authorized, server will respond with 401 and a message
Display the message
How the backend handles the requests:
Examines the request
if location of user is not recognized, responds and requests user email
validates email against user location
if validation fails, then user is not authorized, responds with 401 and a message
if validation passes, responds with a new token
~Backend api is not ready yet.~
IMPORTANT:
Please rename /tiktok to /auth you can find this in router/index.js
### Step 1
## user's location is not recognized, additional info is required i.e registered email
POST /api/v1/auth/magiclink
response {
"action_required":true,
"required": {
"email":"Looks like this is your first signing in with magiclink! Kindly provide your registered email for verification."
}
}
statusCode: 422
### Step 2
## prompt user to provide registered email, send that along in the request
POST /api/v1/auth/magiclink?email={email}
## success:
response {
token:{token},
_d:{id}
}
statusCode: 200
## redirect user to `/#/auth?token={token}&_d={_d}
## error:
response {
error: "message"
}
## display the error message
statusCode: 401
Authorized uses are users that have been given the permission to access select features like signing in with magic link. The permissions are handled in the back office.
When a user clicks on the button to login with magic link:
How the backend handles the requests:
~Backend api is not ready yet.~