Open
Description
- Ask the user to
Connect Wallet
. - Fetch the user's
accountNumber
. - Send a POST request to
/api/v1/users/create
to get the nonce of the user.
Body of the request:
{
accountNumber": "c22f224dac22c6d02e94936f8ac256736555dcf270649f090b201a1bede9c5c8"
}
Response:
{
"_id": "6277bf9459056edfe3a657ce",
"accountNumber": "c22f224dac22c6d02e94936f8ac256736555dcf270649f090b201a1bede9c5c8",
"nonce": 768051,
"createdAt": "2022-05-08T13:03:16.222Z",
"updatedAt": "2022-05-08T13:03:16.222Z",
"__v": 0
}
- Once we have the nonce, ask the user to sign the message
Signing my leapchain nonce: NONCE
. - Once we have the signature, send a POST request to
api/v1/auth
endpoint with the body:
{
"accountNumber": "22d0f0047b572a6acb6615f7aae646b0b96ddc58bfd54ed2775f885baeba3d6a",
"signature": "0777ba24c5d916b271216afbfc4844813343dec58388a3732bafe92c6be16ced280ec8dfe43b2204d79c44a418e58307a992d130054482e6da6e5dad412dad00"
}
- If success, the response will be
{
"user": {
"_id": "625bfccbf6d2b7ed9f7a8da8",
"accountNumber": "22d0f0047b572a6acb6615f7aae646b0b96ddc58bfd54ed2775f885baeba3d6a",
"nonce": 353378,
"createdAt": "2022-04-17T11:40:59.773Z",
"updatedAt": "2022-05-13T12:42:06.834Z",
"__v": 0
},
"accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MjViZmNjYmY2ZDJiN2VkOWY3YThkYTgiLCJpYXQiOjE2NTI0NDU3MjYsImV4cCI6MTY1NTAzNzcyNn0.FvcbVsc8-pfo20wsWjFeej-aGeI13af77Zq2eH8oGuE"
}
- Store the
accessToken
for JWT-based authentication.
PS: We are not using the JWT yet.
Metadata
Metadata
Assignees
Labels
No labels
Activity