{"id":19644,"date":"2026-11-19T01:27:54","date_gmt":"2026-11-18T19:57:54","guid":{"rendered":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/"},"modified":"2026-11-19T01:27:54","modified_gmt":"2026-11-18T19:57:54","slug":"otp-widget-react-fast2sms","status":"publish","type":"post","link":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/","title":{"rendered":"React OTP verification component with Fast2SMS Smart OTP (free example)"},"content":{"rendered":"<p>To add OTP verification to a React app with Fast2SMS, drop the <code>&lt;F2sOtp \/&gt;<\/code> component into your page and point it at your own backend. The component shows the mobile field, the code boxes and the resend timer, and calls <code>onVerified<\/code> with a signed token once the number is verified through <strong>Smart OTP<\/strong> (SMS and WhatsApp with fallback). It works with Vite, Create React App, Remix and other React 17+ set-ups.<\/p>\n<aside class=\"f2s-cta\" aria-label=\"Get started with Fast2SMS\"><div class=\"f2s-cta__copy\"><strong class=\"f2s-cta__title\">Add OTP login to your React app<\/strong><p>Create a Smart OTP template and verify users on SMS or WhatsApp with one component.<\/p><\/div><div class=\"f2s-cta__actions\"><a class=\"f2s-cta__btn f2s-cta__btn--primary\" href=\"https:\/\/www.fast2sms.com\/\"><span>Sign up free<\/span> <span class=\"f2sh-btn__arrow\" aria-hidden=\"true\">&rarr;<\/span><\/a><a class=\"f2s-cta__btn f2s-cta__btn--ghost\" href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Book a free meeting<\/a><\/div><\/aside>\n<p class=\"f2s-kit-wrap\"><a class=\"f2s-kit\" href=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/fast2sms-otp-widget-react.zip\" download><svg class=\"f2s-kit__icon\" width=\"28\" height=\"28\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path fill=\"#7F56D9\" d=\"M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z\"\/><path fill=\"#FFFFFF\" d=\"M14 2v6h6\"\/><path fill=\"#FFFFFF\" d=\"M9 6h2v2H9zm2 2h2v2h-2zM9 10h2v2H9zm2 2h2v2h-2zm-2 2h4v4H9z\"\/><rect x=\"10\" y=\"15.4\" width=\"2\" height=\"1.6\" fill=\"#7F56D9\"\/><\/svg><span class=\"f2s-kit__text\"><strong>Download the React OTP widget example (zip)<\/strong><span class=\"f2s-kit__meta\">fast2sms-otp-widget-react.zip &middot; 27 KB<\/span><\/span><span class=\"f2s-kit__btn\">Download .zip<\/span><\/a><\/p>\n<p class=\"f2s-kit-wrap\"><a class=\"f2s-kit\" href=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/fast2sms-otp-widget-all.zip\" download><svg class=\"f2s-kit__icon\" width=\"28\" height=\"28\" viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path fill=\"#7F56D9\" d=\"M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2z\"\/><path fill=\"#FFFFFF\" d=\"M14 2v6h6\"\/><path fill=\"#FFFFFF\" d=\"M9 6h2v2H9zm2 2h2v2h-2zM9 10h2v2H9zm2 2h2v2h-2zm-2 2h4v4H9z\"\/><rect x=\"10\" y=\"15.4\" width=\"2\" height=\"1.6\" fill=\"#7F56D9\"\/><\/svg><span class=\"f2s-kit__text\"><strong>Download the complete OTP widget kit (zip)<\/strong><span class=\"f2s-kit__meta\">fast2sms-otp-widget-all.zip &middot; 1 MB<\/span><\/span><span class=\"f2s-kit__btn\">Download .zip<\/span><\/a><\/p>\n<h2>What you get<\/h2>\n<div class=\"f2s-facts\">\n<table>\n<thead>\n<tr>\n<th>File<\/th>\n<th>What it is<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>src\/F2sOtp.jsx<\/code><\/td>\n<td>The component. Props: <code>endpoint<\/code>, <code>otpId<\/code>, <code>form<\/code>, <code>onVerified<\/code>, <code>onSent<\/code>, <code>onError<\/code>, <code>texts<\/code>, <code>className<\/code>, <code>style<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>src\/Examples.jsx<\/code><\/td>\n<td><code>LoginExample<\/code> and <code>SignupExample<\/code>.<\/td>\n<\/tr>\n<tr>\n<td><code>src\/f2s-otp-widget.js<\/code><\/td>\n<td>The browser widget the component wraps.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>The component talks only to your backend, never to Fast2SMS. React needs one of the kit&#8217;s backends (see the OTP widget overview); the Node.js with Express backend is the natural fit.<\/p>\n<h2>Before you start<\/h2>\n<ul>\n<li>A Fast2SMS account with wallet balance and an approved DLT OTP template or WhatsApp Authentication\/Utility template.<\/li>\n<li>A React 17 or newer app.<\/li>\n<li>A server where one of the kit&#8217;s backends can run.<\/li>\n<\/ul>\n<h2>Set up OTP in React<\/h2>\n<ol class=\"f2s-steps\">\n<li>\n<h3>Create a Smart OTP template and copy its OTP ID<\/h3>\n<p>In the Fast2SMS panel, open <strong>Smart OTP<\/strong> &gt; <strong>OTP Template List<\/strong> and click <strong>Add OTP Template<\/strong>. Pick <strong>SMS Channel<\/strong> with your approved DLT OTP template, or <strong>WhatsApp Channel<\/strong> with an approved Authentication or Utility template. You can add a fallback on the other channel. Then copy the 10-character <strong>OTP ID<\/strong> from the card. It decides the channel, the template and the fallback for every code the widget sends.<\/p>\n<figure class=\"f2s-shot\"><img src=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-template-list-hd-29-scaled.webp\" width=\"1440\" height=\"900\" loading=\"lazy\" decoding=\"async\" alt=\"Smart OTP Template page with WhatsApp and SMS OTP template cards, each showing its OTP ID, sender or number, template ID and fallback\"><figcaption>Copy the OTP ID from the template card.<\/figcaption><\/figure>\n<\/li>\n<li>\n<h3>Run a backend that holds your API key<\/h3>\n<p>The widget never calls Fast2SMS. It calls a small backend that you run, and only that backend knows your API key. The full kit has ready backends for PHP hosting (one file), Node.js with Express, Python Flask, Django, Laravel, Cloudflare Workers, Vercel or Netlify functions and Google Apps Script (see the OTP widget overview). Copy the key from <strong>API Key<\/strong> under UTILITY in the panel, and give the backend these three settings:<\/p>\n<pre><code class=\"language-bash\">FAST2SMS_API_KEY=YOUR_API_KEY\nF2S_OTP_ID=YOUR_OTP_ID\nF2S_TOKEN_SECRET=at-least-32-random-characters<\/code><\/pre>\n<p><code>F2S_TOKEN_SECRET<\/code> is any random text of 32 or more characters. The backend will not start (or, on PHP and serverless hosts, refuses every request) if one of these is missing or wrong. For local work, proxy <code>\/f2s-otp<\/code> from your dev server to the backend.<\/p>\n<figure class=\"f2s-shot\"><img src=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/api-key-hd-31-scaled.webp\" width=\"1440\" height=\"900\" loading=\"lazy\" decoding=\"async\" alt=\"API Key page with the masked Authorization Key, View and Reset buttons and the API Access switch turned on\"><figcaption>The key goes into your backend settings only.<\/figcaption><\/figure>\n<\/li>\n<li>\n<h3>Proxy the endpoint in development<\/h3>\n<p>With Vite, add a proxy so the app and the backend look like one site. The Node.js backend kit listens on port 3000 by default.<\/p>\n<pre><code class=\"language-js\">\/\/ vite.config.js\nexport default {\n  server: { proxy: { '\/f2s-otp': 'http:\/\/127.0.0.1:3000' } },\n};<\/code><\/pre>\n<p>In production, serve the endpoint from the same domain, or add your site to the backend&#8217;s <code>F2S_ALLOWED_ORIGINS<\/code>.<\/p>\n<\/li>\n<li>\n<h3>Add the component<\/h3>\n<p>Copy <code>F2sOtp.jsx<\/code> and <code>f2s-otp-widget.js<\/code> into <code>src\/<\/code>, then use it on your log-in page:<\/p>\n<pre><code class=\"language-jsx\">import F2sOtp from '.\/F2sOtp.jsx';\n\nexport default function Login() {\n  async function onVerified({ token }) {\n    await fetch('\/login', {\n      method: 'POST',\n      headers: { 'Content-Type': 'application\/json' },\n      body: JSON.stringify({ f2s_token: token }),\n    });\n  }\n  return &lt;F2sOtp endpoint=\"\/f2s-otp\" onVerified={onVerified} \/&gt;;\n}<\/code><\/pre>\n<figure class=\"f2s-shot\"><img src=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/otp-widget-code-step-2x-1.webp\" width=\"520\" height=\"860\" loading=\"lazy\" decoding=\"async\" alt=\"OTP widget after Send OTP: six code boxes, a Verify button, a Resend code countdown and the text Code sent\"><figcaption>After Send OTP: six code boxes and a Resend countdown.<\/figcaption><\/figure>\n<\/li>\n<\/ol>\n<h2>Protect a sign-up form in React<\/h2>\n<p>Pass a form ref instead of using the log-in box. The form can then be submitted only after verification, and the widget adds a hidden <code>f2s_token<\/code> field.<\/p>\n<pre><code class=\"language-jsx\">import { useRef } from 'react';\nimport F2sOtp from '.\/F2sOtp.jsx';\n\nexport function Signup() {\n  const form = useRef(null);\n  return (\n    &lt;&gt;\n      &lt;form ref={form} action=\"\/signup\" method=\"post\" data-mobile-field=\"mobile\"&gt;\n        &lt;input name=\"name\" required \/&gt;\n        &lt;input name=\"mobile\" type=\"tel\" required \/&gt;\n        &lt;div data-f2s-slot \/&gt;\n        &lt;button type=\"submit\"&gt;Create account&lt;\/button&gt;\n      &lt;\/form&gt;\n      &lt;F2sOtp endpoint=\"\/f2s-otp\" form={form} \/&gt;\n    &lt;\/&gt;\n  );\n}<\/code><\/pre>\n<h2>Check the token on your server<\/h2>\n<p>Never log anyone in from the <code>onVerified<\/code> event alone. Your <code>\/login<\/code> or <code>\/signup<\/code> route must check the token with the backend kit&#8217;s helper and use the number it returns:<\/p>\n<pre><code class=\"language-js\">\/\/ Node.js \/ Express backend kit\nconst v = await otp.verifyToken(req.body.f2s_token, { mobile: req.body.phone });\nif (&#33;v) return res.status(403).send('Mobile number not verified.');\n\/\/ v.mobile is the verified 10-digit number. A token works only once.<\/code><\/pre>\n<pre><code class=\"language-php\">&lt;?php\n\/\/ PHP single-file backend kit\nrequire __DIR__ . '\/f2s-otp.php';\n$v = \\F2sOtp\\verify_token($_POST['f2s_token'] ?? '', $_POST['phone'] ?? null);\nif ($v === null) { http_response_code(403); exit('Mobile number not verified.'); }\n\/\/ $v['mobile'] is the verified 10-digit number.<\/code><\/pre>\n<aside class=\"f2s-cta\" aria-label=\"Get started with Fast2SMS\"><div class=\"f2s-cta__copy\"><strong class=\"f2s-cta__title\">Verify users in your React app<\/strong><p>Sign up for Fast2SMS, copy your OTP ID and keep the API key on your server.<\/p><\/div><div class=\"f2s-cta__actions\"><a class=\"f2s-cta__btn f2s-cta__btn--primary\" href=\"https:\/\/www.fast2sms.com\/\"><span>Sign up free<\/span> <span class=\"f2sh-btn__arrow\" aria-hidden=\"true\">&rarr;<\/span><\/a><a class=\"f2s-cta__btn f2s-cta__btn--ghost\" href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Book a free meeting<\/a><\/div><\/aside>\n<h2>Good to know<\/h2>\n<ul>\n<li><strong>Keep the key out of React.<\/strong> Never put the Fast2SMS API key in React code or in <code>VITE_*<\/code> or <code>REACT_APP_*<\/code> variables. Those end up in the browser bundle.<\/li>\n<li><strong>Texts are read once.<\/strong> To change the texts, give the component a new <code>key<\/code> so it rebuilds.<\/li>\n<li><strong>StrictMode is fine.<\/strong> The component mounts one widget even when React mounts, unmounts and mounts again.<\/li>\n<li><strong>Theming:<\/strong> CSS variables such as <code>--f2s-primary<\/code> on <code>.f2s-otp<\/code>.<\/li>\n<\/ul>\n<h2>Limits and cost<\/h2>\n<div class=\"f2s-facts\">\n<table>\n<thead>\n<tr>\n<th>Backend setting<\/th>\n<th>Default<\/th>\n<th>What it does<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>F2S_RESEND_WAIT<\/code><\/td>\n<td>30 seconds<\/td>\n<td>Wait between two sends to one number.<\/td>\n<\/tr>\n<tr>\n<td><code>F2S_LIMIT_PER_NUMBER<\/code><\/td>\n<td>5 per hour<\/td>\n<td>Sends to one mobile number.<\/td>\n<\/tr>\n<tr>\n<td><code>F2S_LIMIT_PER_IP<\/code><\/td>\n<td>20 per hour<\/td>\n<td>Sends from one IP address.<\/td>\n<\/tr>\n<tr>\n<td><code>F2S_LIMIT_VERIFY_PER_IP<\/code><\/td>\n<td>60 per hour<\/td>\n<td>Verify calls from one IP address.<\/td>\n<\/tr>\n<tr>\n<td><code>F2S_MAX_VERIFY<\/code><\/td>\n<td>5<\/td>\n<td>Wrong codes allowed for one code.<\/td>\n<\/tr>\n<tr>\n<td><code>F2S_TOKEN_TTL<\/code><\/td>\n<td>600 seconds<\/td>\n<td>How long the verified token lasts.<\/td>\n<\/tr>\n<tr>\n<td><code>F2S_CAPTCHA<\/code><\/td>\n<td>off<\/td>\n<td><code>turnstile<\/code> or <code>recaptcha<\/code>, with <code>F2S_CAPTCHA_SECRET<\/code>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>Resend sends the same code again.<\/strong> Fast2SMS allows it within 10 minutes of the first send, up to 5 sends in total. Sending a fresh code for a number cancels the older code. If the template has a fallback and the first channel fails, Fast2SMS sends the same code once on the other channel.<\/p>\n<p>Each send and each resend is charged at your Smart OTP rate. Verify is free. If a fallback message goes out on the second channel, that message is charged too, and so is a <strong>Test OTP<\/strong> from the template card, because it is a real send. See the current rates on the <a href=\"https:\/\/www.fast2sms.com\/otp-sms\">Smart OTP page<\/a>.<\/p>\n<div class=\"f2s-note f2s-volume\"><p><strong>Sending in bulk?<\/strong> For high OTP volumes our team offers discounted rates. <a href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Talk to our team<\/a> or see <a href=\"https:\/\/www.fast2sms.com\/bulk-sms-pricing\">OTP pricing<\/a>.<\/p><\/div>\n<h2>How this example was tested<\/h2>\n<p>The React example was bundled with esbuild and run in headless Chrome with React 18.3.1 in <code>&lt;StrictMode&gt;<\/code>, against the Node.js backend and a test server that answers like Fast2SMS. All 3 checks passed: one widget per mount, <code>onVerified<\/code> gets the token, and the protected form submits a token the server accepts. No real SMS was sent, so do one live send with your own template before launch.<\/p>\n<section class=\"f2s-faq\">\n<h2>Frequently asked questions<\/h2>\n<h3>Which backend should I use with React?<\/h3>\n<p>Any backend in the kit works, because they all speak the same JSON. If your API is already Node.js, use the Express backend. For a static React site, the Cloudflare Worker or Vercel\/Netlify backend works.<\/p>\n<h3>Can I call the Fast2SMS OTP API straight from React?<\/h3>\n<p>No. That would put your API key in the browser, where anyone can copy it and spend your wallet. The component calls your backend, and the backend calls Fast2SMS.<\/p>\n<h3>Does it work with Next.js?<\/h3>\n<p>Use the separate Next.js example. It adds a route handler as the backend and a client component that loads the widget in the browser only.<\/p>\n<h3>How do I send OTP on WhatsApp instead of SMS?<\/h3>\n<p>Create a WhatsApp OTP template in Smart OTP and use its OTP ID. If the page needs a different OTP ID from the default, add it to the backend&#8217;s <code>F2S_OTP_IDS<\/code> and pass it as the <code>otpId<\/code> prop.<\/p>\n<h3>What happens when the user taps Resend?<\/h3>\n<p>The same code is sent again. Fast2SMS allows that within 10 minutes and up to 5 sends in total, and each resend is charged.<\/p>\n<h3>Can I change the button text?<\/h3>\n<p>Yes. Pass <code>texts<\/code>, for example <code>{ send: 'Get code' }<\/code>. Texts are read once, so change the component&#8217;s <code>key<\/code> to apply new ones.<\/p>\n<\/section>\n<aside class=\"f2s-cta\" aria-label=\"Get started with Fast2SMS\"><div class=\"f2s-cta__copy\"><strong class=\"f2s-cta__title\">Launch OTP login this week<\/strong><p>Create your Fast2SMS account and add verified mobile login to your React app.<\/p><\/div><div class=\"f2s-cta__actions\"><a class=\"f2s-cta__btn f2s-cta__btn--primary\" href=\"https:\/\/www.fast2sms.com\/\"><span>Sign up free<\/span> <span class=\"f2sh-btn__arrow\" aria-hidden=\"true\">&rarr;<\/span><\/a><a class=\"f2s-cta__btn f2s-cta__btn--ghost\" href=\"https:\/\/www.fast2sms.com\/meet\/\" target=\"_blank\" rel=\"noopener\">Book a free meeting<\/a><\/div><\/aside>\n<h2>Related guides<\/h2>\n<ul>\n<li><a href=\"\/help\/smart-otp-setup-guide-fast2sms\/\">Smart OTP in Fast2SMS: set up OTP on SMS and WhatsApp with fallback<\/a><\/li>\n<li><a href=\"\/help\/login-otp-flow\/\">Build a phone number login with OTP (Fast2SMS Smart OTP)<\/a><\/li>\n<li><a href=\"\/help\/otp-input-screen-ux\/\">OTP verification screen UX: input field, resend timer and error messages<\/a><\/li>\n<li><a href=\"\/help\/otp-sms-pumping-fraud-protection\/\">OTP fraud and SMS pumping: how to protect your OTP form and wallet<\/a><\/li>\n<li><a href=\"\/help\/smart-otp-verify-otp-api\/\">Fast2SMS Verify OTP API: how OTP verification works (with code)<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>To add OTP verification to a React app with Fast2SMS, drop the &lt;F2sOtp \/&gt; component into your page and point it at your own backend. The component shows the mobile field, the code boxes and the resend timer, and calls onVerified with a signed token once the number is verified through Smart OTP (SMS and [&hellip;]<\/p>\n","protected":false},"featured_media":19641,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-19644","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api","category-otp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>React OTP Verification Component | Fast2SMS<\/title>\n<meta name=\"description\" content=\"Add OTP verification to a React app with the free Fast2SMS F2sOtp component: SMS or WhatsApp codes, protected forms and a server-side token check.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"React OTP Verification Component | Fast2SMS\" \/>\n<meta property=\"og:description\" content=\"Add OTP verification to a React app with the free Fast2SMS F2sOtp component: SMS or WhatsApp codes, protected forms and a server-side token check.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/\" \/>\n<meta property=\"og:site_name\" content=\"Fast2SMS\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Fast2SMS\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-18T19:57:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-template-list-hd-29-scaled.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fast2sms\" \/>\n<meta name=\"twitter:site\" content=\"@fast2sms\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/\"},\"author\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\"},\"headline\":\"React OTP verification component with Fast2SMS Smart OTP (free example)\",\"datePublished\":\"2026-11-18T19:57:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/\"},\"wordCount\":1206,\"publisher\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-template-list-hd-29-scaled.webp\",\"articleSection\":[\"API\",\"OTP\"],\"inLanguage\":\"en-IN\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/\",\"name\":\"React OTP Verification Component | Fast2SMS\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-template-list-hd-29-scaled.webp\",\"datePublished\":\"2026-11-18T19:57:54+00:00\",\"description\":\"Add OTP verification to a React app with the free Fast2SMS F2sOtp component: SMS or WhatsApp codes, protected forms and a server-side token check.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/#breadcrumb\"},\"inLanguage\":\"en-IN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-IN\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-template-list-hd-29-scaled.webp\",\"contentUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/smart-otp-template-list-hd-29-scaled.webp\",\"width\":2560,\"height\":1600,\"caption\":\"Smart OTP Template page with WhatsApp and SMS OTP template cards, each showing its OTP ID, sender or number, template ID and fallback\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/otp-widget-react-fast2sms\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"API\",\"item\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/api\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"React OTP verification component with Fast2SMS Smart OTP (free example)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/#website\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/help\\\/\",\"name\":\"Fast2SMS\",\"description\":\"Help\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\"},\"inLanguage\":\"en-IN\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#organization\",\"name\":\"Fast2SMS\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#logo\",\"url\":\"https:\\\/\\\/www.fast2sms.com\\\/Fast2SMS.png\",\"contentUrl\":\"https:\\\/\\\/www.fast2sms.com\\\/Fast2SMS.png\",\"caption\":\"Fast2SMS\"},\"image\":{\"@id\":\"https:\\\/\\\/www.fast2sms.com\\\/#logo\"},\"email\":\"support@fast2sms.com\",\"telephone\":\"+91-6262778822\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Fast2SMS\",\"https:\\\/\\\/www.instagram.com\\\/fast2sms\",\"https:\\\/\\\/x.com\\\/fast2sms\",\"https:\\\/\\\/www.youtube.com\\\/Fast2SMSofficial\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/fast2sms\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"React OTP Verification Component | Fast2SMS","description":"Add OTP verification to a React app with the free Fast2SMS F2sOtp component: SMS or WhatsApp codes, protected forms and a server-side token check.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/","og_locale":"en_US","og_type":"article","og_title":"React OTP Verification Component | Fast2SMS","og_description":"Add OTP verification to a React app with the free Fast2SMS F2sOtp component: SMS or WhatsApp codes, protected forms and a server-side token check.","og_url":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/","og_site_name":"Fast2SMS","article_publisher":"https:\/\/www.facebook.com\/Fast2SMS\/","article_published_time":"2026-11-18T19:57:54+00:00","og_image":[{"width":2560,"height":1600,"url":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-template-list-hd-29-scaled.webp","type":"image\/webp"}],"twitter_card":"summary_large_image","twitter_creator":"@fast2sms","twitter_site":"@fast2sms","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/#article","isPartOf":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/"},"author":{"@id":"https:\/\/www.fast2sms.com\/#organization"},"headline":"React OTP verification component with Fast2SMS Smart OTP (free example)","datePublished":"2026-11-18T19:57:54+00:00","mainEntityOfPage":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/"},"wordCount":1206,"publisher":{"@id":"https:\/\/www.fast2sms.com\/#organization"},"image":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-template-list-hd-29-scaled.webp","articleSection":["API","OTP"],"inLanguage":"en-IN"},{"@type":"WebPage","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/","url":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/","name":"React OTP Verification Component | Fast2SMS","isPartOf":{"@id":"https:\/\/www.fast2sms.com\/help\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/#primaryimage"},"image":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/#primaryimage"},"thumbnailUrl":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-template-list-hd-29-scaled.webp","datePublished":"2026-11-18T19:57:54+00:00","description":"Add OTP verification to a React app with the free Fast2SMS F2sOtp component: SMS or WhatsApp codes, protected forms and a server-side token check.","breadcrumb":{"@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/#breadcrumb"},"inLanguage":"en-IN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/"]}]},{"@type":"ImageObject","inLanguage":"en-IN","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/#primaryimage","url":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-template-list-hd-29-scaled.webp","contentUrl":"https:\/\/www.fast2sms.com\/help\/wp-content\/uploads\/2026\/11\/smart-otp-template-list-hd-29-scaled.webp","width":2560,"height":1600,"caption":"Smart OTP Template page with WhatsApp and SMS OTP template cards, each showing its OTP ID, sender or number, template ID and fallback"},{"@type":"BreadcrumbList","@id":"https:\/\/www.fast2sms.com\/help\/otp-widget-react-fast2sms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.fast2sms.com\/help\/"},{"@type":"ListItem","position":2,"name":"API","item":"https:\/\/www.fast2sms.com\/help\/api\/"},{"@type":"ListItem","position":3,"name":"React OTP verification component with Fast2SMS Smart OTP (free example)"}]},{"@type":"WebSite","@id":"https:\/\/www.fast2sms.com\/help\/#website","url":"https:\/\/www.fast2sms.com\/help\/","name":"Fast2SMS","description":"Help","publisher":{"@id":"https:\/\/www.fast2sms.com\/#organization"},"inLanguage":"en-IN"},{"@type":"Organization","@id":"https:\/\/www.fast2sms.com\/#organization","name":"Fast2SMS","url":"https:\/\/www.fast2sms.com\/","logo":{"@type":"ImageObject","@id":"https:\/\/www.fast2sms.com\/#logo","url":"https:\/\/www.fast2sms.com\/Fast2SMS.png","contentUrl":"https:\/\/www.fast2sms.com\/Fast2SMS.png","caption":"Fast2SMS"},"image":{"@id":"https:\/\/www.fast2sms.com\/#logo"},"email":"support@fast2sms.com","telephone":"+91-6262778822","sameAs":["https:\/\/www.facebook.com\/Fast2SMS","https:\/\/www.instagram.com\/fast2sms","https:\/\/x.com\/fast2sms","https:\/\/www.youtube.com\/Fast2SMSofficial","https:\/\/www.linkedin.com\/company\/fast2sms"]}]}},"_links":{"self":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/posts\/19644","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/comments?post=19644"}],"version-history":[{"count":0,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/posts\/19644\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/media\/19641"}],"wp:attachment":[{"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/media?parent=19644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/categories?post=19644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fast2sms.com\/help\/wp-json\/wp\/v2\/tags?post=19644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}