📜 Get MatchID User Dapp Login History
You can retrieve the list of dapps a user has logged into using their MatchID credentials. This includes both Web3 wallet logins and social platform logins (e.g., Telegram, Twitter, Discord).
✅ Endpoint
http
POST https://api.matchid.ai/api/v1/partner/user/dapps/login/log
📥 Request Structure
You must send a signed request using your APP_ID
and SECRET_KEY
.
📌 Request Body (JSON)
json
{
"requestBody": "{\"did\":\"did:matchid:73f2bdc89ae1f6d7a4e952af23\"}"
}
The value of requestBody must be a JSON stringified object.
🔐 Headers
Header | Description |
---|---|
Content-Type | application/json |
appid | Your MatchID App ID |
timestamp | Current Unix timestamp (in milliseconds) |
sign | Base64-encoded HMAC-SHA256 of timestamp + method + path + body |
🔏 Signature Generation
js
const signatureBase = timestamp + method + endpoint + body;
const signature = CryptoJS.HmacSHA256(signatureBase, SECRET_KEY);
const sign = CryptoJS.enc.Base64.stringify(signature);
- timestamp: current time in milliseconds
- method: "POST"
- endpoint: /api/v1/partner/user/dapps/login/log
- body: stringified version of
📄 Response
✅ If Successful
If the request is successful, you will receive a list of dapps the user has logged into within the past 30 days:
json
{
"code": 0,
"data": [
{
"dapp_name": "PPP",
"login_platform": "EVM",
"login_time": 1751275437
},
{
"dapp_name": "AAA",
"login_platform": "Telegram",
"login_time": 1752635135
},
],
"message": "successfully"
}
Field | Description |
---|---|
dapp_name | Name of the dapp the user logged into |
login_platform | Login method used (EVM , Telegram , etc.) |
login_time | UNIX timestamp of the login event |
🔁 Full Example (Node.js + Axios)
js
const axios = require("axios");
const CryptoJS = require("crypto-js");
// === CONFIG ===
const APP_ID = "your app id"; // Replace with your MatchID app id
const SECRET_KEY = "your app secret"; // Replace with your MatchID secret key
const BASE_URL = "https://api.matchid.ai";
const ENDPOINT = "/api/v1/partner/user/dapps/login/log";
const did = "did:matchid:73f2bdc89ae1f6d7a4e952af23"; // User's did retrieved in your dapp after users logged in with MatchID
// === Step 1: Prepare body ===
const body = JSON.stringify({ did });
const requestBody = { requestBody: body };
// === Step 2: Generate signature ===
const timestamp = Date.now().toString();
const method = "POST";
const signatureBase = timestamp + method + ENDPOINT + body;
const signature = CryptoJS.HmacSHA256(signatureBase, SECRET_KEY);
const sign = CryptoJS.enc.Base64.stringify(signature);
// === Step 3: Send request ===
axios.post(`${BASE_URL}${ENDPOINT}`, requestBody, {
headers: {
"Content-Type": "application/json",
"appid": APP_ID,
"timestamp": timestamp,
"sign": sign
}
})
.then(res => {
console.log("✅ Success:\n", JSON.stringify(res.data, null, 2));
})
.catch(err => {
console.error("❌ Error:\n", err.response?.data || err.message);
});