LogoLogo
  • Home
  • Overview
  • Getting Started
  • Prompt Guide
  • API Reference
    • Authentication
      • Web3
      • Google OAuth
    • Account
    • Escrow
    • File upload
    • Wallet
Powered by GitBook
On this page
Export as PDF
  1. API Reference
  2. Authentication

Web3

With the Pakt Web API, Chainsite builders can establish user authentication with Web3:

PreviousAuthenticationNextGoogle OAuth

Last updated 10 days ago

Sign Up or Login Request
Sign Up or Login Validation
Onboarding
  • POSTSignup or Login Request
  • POSTSignup or Login Validation
  • POSTOnboarding

Signup or Login Request

post

This endpoint allows you to make an HTTP POST request to {{baseUrl}}/v1/auth/web3/request in order to authenticate using a web3 provider. The request should include a payload with the raw request body type, containing the account information.

Request

  • account: (string) The user's account information.

Response

The response will include the following fields:

  • status: The status of the response.

  • message: A message related to the response status.

  • data: An object containing the following fields:

    • message: A message related to the authentication process.

    • tempToken: An object containing the temporary token information, including:

      • token: The temporary token value.

      • token_type: The type of the token.

      • expiresIn: The expiration time of the token in seconds.

Authorizations
Body
objectOptionalExample: {"account":"0x90b780d7546ab754e35e0d2e80d76557a012d4fe"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/web3/request HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 56

{
  "account": "0x90b780d7546ab754e35e0d2e80d76557a012d4fe"
}
200

OK

{
  "status": "success",
  "message": "0k",
  "data": {
    "message": "I approve afrofund to authenticate with token 1728505838893::5A7sFIIZM9",
    "tempToken": {
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiMHhjMGQ2YjA4MGZiZTZhZDc2Y2JiYTYwMTAxNWUwY2JiZmRhNWJjY2I5IiwibWVzc2FnZSI6IkkgYXBwcm92ZSBhZnJvZnVuZCB0byBhdXRoZW50aWNhdGUgd2l0aCB0b2tlbiAxNzI4NTA1ODM4ODkzOjo1QTdzRklJWk05IiwiYXV0aFR5cGUiOiJzaWduX3VwIiwidGltZVN0YW1wIjoxNzI4NTA1ODM4ODkzLCJpYXQiOjE3Mjg1MDU4MzksImV4cCI6MTcyODYzMTk1OX0.T1Q-oQfk-b5QNSzIu1v89CFgcPtvMeiNODtjRXQT4zBMoWFyhpECCMONcP3PUNM5rybMIxj8pL0M229yFkd5b07nj0Z9qtE8RpbaFdsuakfEdVdvlxu0GNvLNt28sYunt2KyFaty4ifxN2pLaSNBRd73x0fg2Mo5VZ0xRhjZIkfXTxtCO_IgxHRhorYDBsQZzzvFU5gxQWa7ZnIqHoHgCT-aDJRMKKEFNc_EoZlGRKB4g6AMnaTrcLdA0l9wBnXYN-GcgO2ibaEwhTwH-YGx-JX6oIn1DkCPJAcUc4vm4x21dpCXxLkQ35Mud3QdjE8MHHxAhyj1Gdfv_cP-t4LOYQ",
      "token_type": "jwt",
      "expiresIn": 1728631959000
    }
  }
}

Signup or Login Validation

post

This endpoint allows the validation of a Web3 authentication request.

Request

  • signedMessage (string): The signed message from the Web3 provider.

  • tempToken (string): The temporary token obtained from the Web3 authentication process.

Response

The response will contain the status, message, and data objects. The data object will include the account and tempToken, where tempToken will have the token, token_type, and expiresIn properties.

Authorizations
Body
objectOptionalExample: {"signedMessage":"0x1787a65329e4569197b3d4a364b7dae128e44e47739e77fb6e7ff6c7f67d3bc4476978195e190c6eda689374d994508058afec419c6318899d89efef85e26c441c","tempToken":"{{web3_request_token}}"}
Responses
202
Accepted
application/json
Responseobject
post
POST /v1/auth/web3/validate HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 189

{
  "signedMessage": "0x1787a65329e4569197b3d4a364b7dae128e44e47739e77fb6e7ff6c7f67d3bc4476978195e190c6eda689374d994508058afec419c6318899d89efef85e26c441c",
  "tempToken": "{{web3_request_token}}"
}
202

Accepted

{
  "status": "success",
  "message": "Account created successfully, Please complete onboarding to verify your account",
  "data": {
    "account": "0xc0d6b080fbe6ad76cbba601015e0cbbfda5bccb9",
    "tempToken": {
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3MDZlODIwYmZjMjdlYzdkMDI1ZTc0ZCIsImlhdCI6MTcyODUwNTg4OCwiZXhwIjoxNzI4NjMyMDA4fQ.QDlcwqtQtMQ13VDONqvQn2iSOXg4TkHcOQ9X3Z9bGolngdTRqHwx8vxufPqapjtv6ZFErBoF14Bx5Ul44Zcx0WhOkKzUbmI0U5scGSzsbPyzvKSZwUKQ203SPrLN5zcy7XuBEPzFxiYPDglJC2U1hJqcVfd23husHLkR5ah31VjHPGTMnDW6em2rIF_4WW5vyWLM0ezTFIdq1X5vu-ARhi49Tn9yLt2QzVUgrm_R-glfJ8oDlfcksbtqBDV_5_8SfsSCbm6A1YFQQef8JdHHt2lGjVspBzeS9uuZiBMvPwJoWU4pjBT1e1tRFGBuyxTsqOckcHgoY1RJ0zc0ETxIew",
      "token_type": "jwt",
      "expiresIn": 1728632008000
    }
  }
}

Onboarding

post

This endpoint is used to onboard a user using a temporary token from web3.

Request

  • tempToken (string, required): The temporary token obtained from web3.

  • firstName (string, required): The first name of the user.

  • lastName (string, required): The last name of the user.

  • email (string, required): The email address of the user.

Response

The response contains the following information:

  • status: The status of the response, which is "success" in this case.

  • message: A brief message describing the response, which is "account on-boarded" here.

  • data: An object containing additional information about the response.

    • tempToken: An object containing a temporary token.

    • token: The actual token value, which is a JWT (JSON Web Token) string.

    • tokenType: The type of token, which is "jwt" in this case.

    • expiresIn: The timestamp when the token expires, represented as a Unix timestamp in milliseconds.

    • isVerified: A boolean indicating whether the account is verified or not.

Authorizations
Body
objectOptionalExample: {"tempToken":"{{web3_onboard_token}}","firstName":"Jack","lastName":"Mar","email":"mail@example.com"}
Responses
200
OK
application/json
Responseobject
post
POST /v1/auth/web3/onboard HTTP/1.1
Host: {{baseurl}}
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 101

{
  "tempToken": "{{web3_onboard_token}}",
  "firstName": "Jack",
  "lastName": "Mar",
  "email": "mail@example.com"
}
200

OK

{
  "status": "success",
  "message": "account on-boarded",
  "data": {
    "tempToken": {
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjY3M2Y4M2UyZDI5ZjFjMWUyNjYzMjJhZCIsIm93bmVyIjoiNjczZjgzZTJkMjlmMWMxZTI2NjMyMmFkIiwiaWF0IjoxNzMyMjcwMjQ1LCJleHAiOjE3MzIzOTYzNjV9.EvDDHQ4ZRETLPwAWeP_rzu3TPGI46QSeYDIkSKMXtza3CNj2fCceS_iHxhaUOHS-7BT6lfe-q2nGBbMLA8K5cqBXzqE_DJSpAVHfC0Qvp3ut70zr2t0T8N2SzZIs8ePuY6A6vkxSBL7Kyp5Fr4VlAQBGmcSsVkB_18flH8-1la6GRN9L2aSSE8joz-oFpeIPvvFDwwlXclLnPet68Qf4WDIyA9UEyqghnO6FsC1S1EQWjG90DoEi9KKLLsUslAjUSMhsEEqnDDMnbPTpLBSwTWAnu9ZHVoiIEzIdKhEHr4oobwQmKm60ywUs1eJFsbqmcVNb48pwXuuY3B1ixtVXUw",
      "token_type": "jwt",
      "expiresIn": 1732396365000
    },
    "isVerified": false
  }
}