HTTP 请求
curl https://api.iagenify.com/api/auth/sessions/exchange \
-X POST \
-H "Content-Type: application/json" \
-d '{"apiKey":"YOUR_API_KEY"}'JavaScript
const response = await fetch("https://api.iagenify.com/api/auth/sessions/exchange", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ apiKey: process.env.IAGENIFY_API_KEY }),
});
const session = await response.json();
if (!response.ok) throw new Error(session.error);
// Store session.jwt and session.refreshToken only in trusted storage.Python
import os, requests
response = requests.post(
"https://api.iagenify.com/api/auth/sessions/exchange",
json={"apiKey": os.environ["IAGENIFY_API_KEY"]},
timeout=30,
)
response.raise_for_status()
session = response.json()请求体
apiKeystring必填下 API 键交换。
storageIdstring任择储存协会。
storageTypestring客户可选存储类型。
frameworkstring可选客户框架标签。
appNamestring任择申请姓名。
成功响应
{
ok: true,
jwt: "…",
refreshToken: "…",
session: { id: "…", storageId: "…" }
}下个请求
发送返回 JWT 年为 Authorization: Bearer YOUR_JWT。当它过期时,使用 POST /api/auth/refresh; 从来没有在 URL 或浏览器发送源。