/* eslint-disable */ import React, { useState, useEffect } from "react" const SDK_SCRIPT_SNIPPET = `` const SIGNIN_ROOT_SNIPPET = `
` const INIT_SNIPPET = `HamsooID.init({ client_id: "your-client-id", redirect_uri: "https://your-site.com/callback", scope: "openid profile email", response_mode: "web_message", // برای پاپآپ موبایلی onSuccess: ({ code, state }) => { // Exchange code for tokens at: POST /oauth/token console.log("Authorization code:", code, "State:", state) }, onError: (err) => { console.error("Sign in error:", err) }, })` const TOKEN_EXCHANGE_SNIPPET = `import requests resp = requests.post( "https://account.hamsoo.me/oauth/token", data={ "grant_type": "authorization_code", "code": "client_id و redirect_uris را ثبت کنید. گام scopes: openid profile email phone.
body سایت خود قرار دهید:
{SDK_SCRIPT_SNIPPET}
{SIGNIN_ROOT_SNIPPET}
{INIT_SNIPPET}
{TOKEN_EXCHANGE_SNIPPET}
| روش / Method | توضیحات / Description |
|---|---|
| HamsooID.init({"{ options }"}) | ابزار SDK را مقداردهی و دکمه را render میکند |
| onSuccess({"{ code, state }"}) | وقتی کاربر با موفقیت احراز هویت میشود، این تابع صدا زده میشود |
| onError({"{ error }"}) | وقتی احراز هویت شکست خورد، این تابع صدا زده میشود |
تمام endpoints روی دامنه account.hamsoo.me قابل دسترسی هستند.
| Endpoint | روش / Method | توضیحات / Description |
|---|---|---|
| GET /.well-known/openid-configuration | GET | OpenID Discovery document |
| GET /oauth/jwks | GET | JSON Web Key Set for JWT verification |
| GET /oauth/authorize | GET/POST | Authorization endpoint (PKCE + consent) |
| POST /oauth/token | POST | Exchange code for tokens (PKCE) |
| GET /oauth/userinfo | GET | User claims (scope-dependent) |
| GET /sso/login | GET | Central SSO login page (account chooser + MFA + Passkey) |
| POST /api/v1/security/pow/challenge | POST | Self-hosted proof-of-work challenge (anti-bot) |
اپلیکیشنهای خود را در پورتال مدیریت کنید:{" "} account.hamsoo.me/admin/applications