
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
react-geetest-v4
Advanced tools
A very simple React component to integrate GeeTest captcha.
npm install react-geetest-v4
import React from 'react';
import GeeTest, { GeeTestRef } from 'react-geetest-v4';
export default function Home(): JSX.Element {
const captchaRef = React.useRef<GeeTestRef | null>(null); // Access: showCaptcha, reset, ...
return (
<div>
<GeeTest
captchaId={'your captcha id'}
containerId={'geetest-captcha'} // Optional
onSuccess={(result) => console.log('success. result: ', result)}
onReady={() => console.log('ready')}
/>
<br />
<GeeTest
ref={captchaRef}
captchaId={'your captcha id'}
product={'bind'}
onSuccess={() => console.log('success')}
>
<button>Submit</button>
</GeeTest>
</div>
);
}
import React from 'react';
import { useGeeTest } from 'react-geetest-v4';
export default function Home(): JSX.Element {
const { captcha, state } = useGeeTest('your captcha id', {
product: 'bind',
protocol: 'https://',
containerId: 'geetest-captcha',
});
const onClick = () => {
captcha?.showCaptcha();
};
return (
<div>
<button onClick={onClick}>Submit</button>
</div>
);
}
On this example we're using Next.JS handlers, but you can use any other framework.
import type { NextApiRequest, NextApiResponse } from 'next';
import { validateCaptcha, generateSignToken } from 'react-geetest-v4';
const CAPTCHA_ID = '647f5ed2ed8acb4be36784e01556bb71';
const CAPTCHA_KEY = 'b09a7aafbfd83f73b35a9b530d0337bf';
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const { captcha_output, gen_time, lot_number, pass_token } = req.body;
if (!captcha_output || !gen_time || !lot_number || !pass_token) {
return res.status(400).json({ error: 'Missing required parameters' });
}
const { result } = await validateCaptcha({
captcha_id: CAPTCHA_ID,
lot_number,
captcha_output,
pass_token,
gen_time,
sign_token: generateSignToken(lot_number, CAPTCHA_KEY),
});
return res.status(200).json({ ok: result === 'success' });
}
FAQs
React library for GeeTest captcha v4 integration
The npm package react-geetest-v4 receives a total of 125 weekly downloads. As such, react-geetest-v4 popularity was classified as not popular.
We found that react-geetest-v4 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.