Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 1.15 KB

File metadata and controls

40 lines (28 loc) · 1.15 KB

Client Integration

Widget Installation

Add the ALTCHA widget to your form and point challengeurl to this service.

<script async defer src="https://cdn.jsdelivr.net/gh/altcha-org/altcha@main/dist/altcha.min.js" type="module"></script>
<form action="/your-submit" method="POST">
  <input name="email" placeholder="Email" />
  <altcha-widget challengeurl="http://localhost:3000/challenge"></altcha-widget>
  <button>Submit</button>
</form>

On form submission, the altcha field value is included in the request body. Extract this value in your backend and send it to POST /verify for verification. The response code indicates the result:

  • 202 Accepted → Verification successful
  • 417 Expectation Failed → Invalid or reused token

Manual Testing

PowerShell:

# Assuming $payload contains the altcha value from the client
curl http://localhost:3000/verify -Method POST -Body @{altcha=$payload} -UseBasicParsing

Unix/macOS:

curl -X POST \
  -d "altcha=$payload" \
  http://localhost:3000/verify -i

Widget Styling

To customize the widget appearance, see Widget Customization.