{"id":81806,"date":"2026-09-14T16:39:04","date_gmt":"2026-09-14T11:09:04","guid":{"rendered":"https:\/\/tothenew.xyz\/blog\/?p=81806"},"modified":"2026-11-25T14:09:44","modified_gmt":"2026-11-25T08:39:44","slug":"understanding-hmac-in-flutter-secure-api-requests-explained","status":"publish","type":"post","link":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/","title":{"rendered":"Understanding HMAC in Flutter: Secure API Requests Explained"},"content":{"rendered":"<h1>Introduction<\/h1>\n<p>All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application&#8217;s\u00a0 data or the server data. One such case of hackers infiltrating the resources, is related to weak API verification step. If your API verifies the API key just by checking whether it is present in a header of the request, you are one step away from a spoofed request. This is where <strong>HMAC (Hash-based Message Authentication Code)<\/strong> comes into picture.<\/p>\n<p>The following blog post is devoted to HMAC and will cover what HMAC is, why it is important for securing your API, and how to use it in Flutter application.<\/p>\n<h2><\/h2>\n<h2><strong>What Is HMAC, Really?<\/strong><\/h2>\n<p>HMAC in simple terms is used to prove two things simultaneously: that the request sent by the application is attached with a common secret key , and that during transmission the request sent by the Application is not tampered. So it uses a cryptographic hash function (commonly SHA-256) with a secret key to produce a fixed-length signature.<\/p>\n<p>The core idea is simple:<\/p>\n<pre><span style=\"color: #008000;\">signature = HMAC(secret_key, message)<\/span><\/pre>\n<p>The application creates a signature using the available information from the request (endpoint, timestamp, body, etc) and a secret key kept secret between the client and the server. The server then recalculates the signature without relying on the application side and compares it with the previous signature. If they both match, the request is not altered and is genuine. If the payload is modified by an attacker even by a single character, the signature will not match and the server will reject the request.<\/p>\n<p>As opposed to the simple API key passed in the header, the HMAC signature is dependent on the content of each particular request. Obtaining the signature of one particular request will not allow an attacker to create another, since they don&#8217;t have the secret key needed to generate a new valid signature.<\/p>\n<h2>Why Flutter Apps Need This<\/h2>\n<p>Mobile applications have a perceived notion of lack of trust as they are working on devices outside of the developers control, and an attacker can decompile the app, intercept requests via a proxy, or replay them. HMAC is useful in mitigating multiple potential attacks like:<\/p>\n<ul>\n<li><strong>Request tampering<\/strong> \u2014 an attacker modifying a request body mid-transit can be intercepted immediately.<\/li>\n<li><strong>Replay attacks<\/strong> \u2014 combined with timestamps or nonces, the old captured requests become useless.<\/li>\n<li><strong>Basic request forger<\/strong>y \u2014 without the shared secret key, generating a valid signature is of no use.<\/li>\n<\/ul>\n<p>While doing development with this approach, due diligence should also be given about what HMAC cannot solve. The secret key will not be protected if someone tries to reverse engineer the binary of the application and HMAC cannot replace TLS. but it can be used to make it harder for attackers by serving as an additional security layer.<\/p>\n<h2>Setting Up the Flutter Project<\/h2>\n<p>First we need to add these packages to <span style=\"color: #008000;\">pubspec.yaml<\/span>:<\/p>\n<div id=\"attachment_81928\" style=\"width: 310px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-81928\" class=\"size-medium wp-image-81928\" src=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Setting_up_Flutter_project-300x83.png\" alt=\"Packages required to setup Project.\" width=\"300\" height=\"83\" srcset=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Setting_up_Flutter_project-300x83.png 300w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Setting_up_Flutter_project-1024x285.png 1024w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Setting_up_Flutter_project-768x214.png 768w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Setting_up_Flutter_project-624x174.png 624w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Setting_up_Flutter_project.png 1230w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><p id=\"caption-attachment-81928\" class=\"wp-caption-text\">Packages required to setup Project<\/p><\/div>\n<p>Run <span style=\"color: #008000;\">flutter pub get<\/span> to fetch them.<\/p>\n<h2>Building the HMAC Signature Generator<\/h2>\n<p>The <span style=\"color: #008000;\">crypto<\/span> package has all the hashing and HMAC functionality you need. To keep the implementation loosely coupled and hence easier to maintain, we can split the logic into two small, focused classes: one that deals with the raw hashing\/HMAC operations and another that deals with constructing the exact string that needs to be signed. Separating these concerns will also lead to better testability, readability and make it easier to change \/ extend either half without affecting the other.<\/p>\n<ol>\n<li>HmacService \u2014 This is a thin wrapper used so the entire App avoids directly touching the crypto package\n<p><div id=\"attachment_81933\" style=\"width: 423px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-81933\" class=\"wp-image-81933 \" src=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacService-1024x621.png\" alt=\"Wrapper class to wrap the crypto package\" width=\"413\" height=\"251\" srcset=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacService-1024x621.png 1024w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacService-300x182.png 300w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacService-768x466.png 768w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacService-624x378.png 624w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacService.png 1382w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><p id=\"caption-attachment-81933\" class=\"wp-caption-text\">Wrapper class to wrap the crypto package<\/p><\/div><\/li>\n<li>SignatureGenerator \u2014 Used to build the canonical string which both client and server must create identically, and then signs it:\n<p><div id=\"attachment_81936\" style=\"width: 400px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-81936\" class=\"wp-image-81936 \" src=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/canonical_string-1024x402.png\" alt=\"Uses the wrapper class function to create signature\" width=\"390\" height=\"153\" srcset=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/canonical_string-1024x402.png 1024w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/canonical_string-300x118.png 300w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/canonical_string-768x301.png 768w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/canonical_string-624x245.png 624w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/canonical_string.png 1290w\" sizes=\"auto, (max-width: 390px) 100vw, 390px\" \/><p id=\"caption-attachment-81936\" class=\"wp-caption-text\">Uses the wrapper class function to create signature<\/p><\/div><\/li>\n<\/ol>\n<p>When hashing the body separately (instead of just concatenating it in raw form into the canonical string), the eventual shape of the string is predictable and bounded, regardless of payload size. Hashing the body separately also avoids subtle bugs that may arise from newlines or other delimiter characters inside the body piggybacking off the canonical string\u2019s own separators.<\/p>\n<p><strong>Integrating HMAC into API Requests<\/strong><\/p>\n<p>Modifying the signature generator into one you actually attach to a request takes three more pieces: a small config object holding your secret key and the header names, a nonce generator for replay protection, and a signer that will pull the timestamp, nonce, canonical string, and signature together into headers.<\/p>\n<ol>\n<li>Config \u2014 secret key, algorithm, and header names in one place:\n<p><div id=\"attachment_81942\" style=\"width: 547px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-81942\" class=\"wp-image-81942 \" src=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacConfig-1024x801.png\" alt=\"Config file holding secret key and header names\" width=\"537\" height=\"420\" srcset=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacConfig-1024x801.png 1024w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacConfig-300x235.png 300w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacConfig-768x601.png 768w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacConfig-1536x1202.png 1536w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacConfig-624x488.png 624w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/HmacConfig.png 1684w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><p id=\"caption-attachment-81942\" class=\"wp-caption-text\">Config file holding secret key and header names<\/p><\/div><\/li>\n<li>Nonce generator \u2014 a random, single-use token so a captured request can&#8217;t just be replayed, even within the timestamp window:\n<p><div id=\"attachment_81943\" style=\"width: 453px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-81943\" class=\"wp-image-81943 \" src=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/NonceGenerator-1024x563.png\" alt=\"Creates a number which prevents replaying requests\" width=\"443\" height=\"244\" srcset=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/NonceGenerator-1024x563.png 1024w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/NonceGenerator-300x165.png 300w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/NonceGenerator-768x422.png 768w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/NonceGenerator-1536x844.png 1536w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/NonceGenerator-624x343.png 624w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/NonceGenerator.png 1758w\" sizes=\"auto, (max-width: 443px) 100vw, 443px\" \/><p id=\"caption-attachment-81943\" class=\"wp-caption-text\">Creates a number which prevents replaying requests<\/p><\/div><\/li>\n<li>Request signer \u2014 this is where it all comes together:\n<p><div id=\"attachment_81949\" style=\"width: 688px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-81949\" class=\"wp-image-81949 \" src=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/RequestSigner-1024x701.png\" alt=\"RequestSigner class in Dart generating an HMAC-SHA256 signature and attaching signed headers to a request.\" width=\"678\" height=\"464\" srcset=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/RequestSigner-1024x701.png 1024w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/RequestSigner-300x205.png 300w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/RequestSigner-768x525.png 768w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/RequestSigner-1536x1051.png 1536w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/RequestSigner-2048x1401.png 2048w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/RequestSigner-624x427.png 624w\" sizes=\"auto, (max-width: 678px) 100vw, 678px\" \/><p id=\"caption-attachment-81949\" class=\"wp-caption-text\">RequestSigner class in Dart generating an HMAC-SHA256 signature and attaching signed headers to a request.<\/p><\/div><\/li>\n<\/ol>\n<p>This is how the whole process works: each invocation of sign() generates a new timestamp and nonce, combines those along with the hash of the path\/method\/body and signs it, and returns a headers map. Add that map to any HTTP request, using any HTTP client:<\/p>\n<pre>import 'package:http\/http.dart' as http;\r\n\r\n\r\nfinal signer = RequestSigner();\r\n\r\nfinal path = '\/v1\/orders';\r\n\r\nfinal body = '{\"itemId\":\"sku_9981\",\"quantity\":2}';\r\n\r\n\r\nfinal headers = signer.sign(method: 'POST', path: path, body: body);\r\n\r\nheaders['Content-Type'] = 'application\/json';\r\n\r\n\r\nfinal response = await http.post(\r\n\r\n\u00a0\u00a0Uri.parse('https:\/\/api.example.com$path'),\r\n\r\n\u00a0\u00a0headers: headers,\r\n\r\n\u00a0\u00a0body: body,\r\n\r\n);\r\n\r\n\r\nprint('Order placed: ${response.body}');<\/pre>\n<p>Here, in the real-world application, such actions would be performed by interceptors, either by using Interceptor provided by Dio itself or using http.Client decorator, so that signing could be automatically performed for all the requests without having to call sign() explicitly every time.<\/p>\n<h2>Verifying the Signature on the Server<\/h2>\n<p>The server-side implementation also requires mirroring the same architecture, which includes hashing the body individually and folding the nonce into the canonical form. Here is an example using Node.js\/Express for you to get a glimpse of both ends of the handshake:<\/p>\n<div id=\"attachment_81950\" style=\"width: 562px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-81950\" class=\"wp-image-81950 \" src=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Verifying_the_signature-1024x778.png\" alt=\"Verifying the Signature on the Server\" width=\"552\" height=\"420\" srcset=\"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Verifying_the_signature-1024x778.png 1024w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Verifying_the_signature-300x228.png 300w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Verifying_the_signature-768x583.png 768w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Verifying_the_signature-1536x1167.png 1536w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Verifying_the_signature-624x474.png 624w, https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Verifying_the_signature.png 1680w\" sizes=\"auto, (max-width: 552px) 100vw, 552px\" \/><p id=\"caption-attachment-81950\" class=\"wp-caption-text\">Verifying the Signature on the Server<\/p><\/div>\n<p>The following three elements are important in addition to the signature verification process: the time period during which the timestamp is fresh, ensuring that nonces are tracked in order to avoid replay attack within that period, and the usage of constant time equality comparison (<span style=\"color: #008000;\">timingSafeEqual<\/span>) function rather than ===, which prevents timing attacks that could leak information about the expected signature byte by byte.<\/p>\n<h2>Best Practices and Common Pitfalls<\/h2>\n<ul>\n<li><strong>Not hardcoding the secret key in the app&#8217;s source.<\/strong> Anything attached with the binary can be extracted. The Secret Key shall be fetched at the runtime from a secure backend after the authentication process, or use of platform-level secure storage (<span style=\"color: #008000;\">flutter_secure_storage<\/span>) once the key is obtained shall be used to have a secured communication.<\/li>\n<li><strong>Including a timestamp or nonce in the signed payload.<\/strong> Including an identifier like a timestamp for the payload helps to execute an action at the uniquely-requested time. Without one, a captured request can be replayed indefinitely.<\/li>\n<li><strong>Signing the full request context, not restricting just to the body<\/strong> \u2014 also including the method and path of the request. Restricting the sign only to the body enables an attacker to redirect a valid signature to a different endpoint.<\/li>\n<li><strong>Use of HTTPS protocol regardless<\/strong> &#8211; On one hand, HMAC protects integrity and authenticity, while HTTPS provides confidentiality. Combining both vastly improves the security of the request.<\/li>\n<li><strong>Keeping payload construction identical on both ends<\/strong> &#8211; Most common source of &#8220;valid request, invalid signature&#8221; bugs are mismatched field order or an encoding issue. Logging the exact string which is being signed on both sides when debugging.<\/li>\n<\/ul>\n<h2>Source Code<\/h2>\n<p>I\u2019ve published the full working demo on GitHub \u2014 it includes a Dio interceptor that automatically signs requests, tamper demos, and a simulated backend verifier: <a href=\"https:\/\/github.com\/rahul-kumawat123\/Demo-Flutter\">Flutter Demo<\/a> clone away, and have a look around.<\/p>\n<h2>Conclusion<\/h2>\n<p>HMAC provides a simple and effective mechanism for covering the legitimacy and integrity of the messages sent by the Mobile application, underpinned by just a shared key and a hashing function. HMAC alone cannot provide defence against all types of attacks, but when combined with TLS, short lived timestamps and proper key handling, it can provide significant protection against message tampering and replay attacks \u2013 without having extended lines of code.<\/p>\n<p>For scenarios of developing software which deal with money transfers, personal information or sensitive operations, this protection protocol shall be implemented as a procedure rather than an optional tool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application&#8217;s\u00a0 data or the server data. [&hellip;]<\/p>\n","protected":false},"author":2154,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[518],"tags":[8867,1221,8868,8869,4969,4968,8746,7383,1898],"class_list":["post-81806","post","type-post","status-publish","format-standard","hentry","category-android","tag-apisecurity","tag-authentication","tag-backendsecurity","tag-cryptography","tag-dart","tag-flutter","tag-hmac","tag-mobilesecurity","tag-networking"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application&#039;s data or the server data.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Rahul Kumawat\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application&#039;s data or the server data.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/tothenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/tothenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application&#039;s data or the server data.\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/tothenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#article\",\"name\":\"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog\",\"headline\":\"Understanding HMAC in Flutter: Secure API Requests Explained\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rahul-kumawat\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/wp-ttn-blog\\\/uploads\\\/2026\\\/09\\\/Setting_up_Flutter_project-300x83.png\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#articleImage\"},\"datePublished\":\"2026-09-14T16:39:04+05:30\",\"dateModified\":\"2026-11-25T14:09:44+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#webpage\"},\"articleSection\":\"Android, APISecurity, authentication, BackendSecurity, Cryptography, Dart, Flutter, hmac, MobileSecurity, Networking\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/android\\\/#listItem\",\"name\":\"Android\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/android\\\/#listItem\",\"position\":2,\"name\":\"Android\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/android\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#listItem\",\"name\":\"Understanding HMAC in Flutter: Secure API Requests Explained\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#listItem\",\"position\":3,\"name\":\"Understanding HMAC in Flutter: Secure API Requests Explained\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/android\\\/#listItem\",\"name\":\"Android\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rahul-kumawat\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rahul-kumawat\\\/\",\"name\":\"Rahul Kumawat\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/c1655ff4-ee52-4a67-a851-a0cfe81eaf5a_Rahul-Kumawat-Profile-Pitcure.jpeg\",\"width\":96,\"height\":96,\"caption\":\"Rahul Kumawat\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/\",\"name\":\"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog\",\"description\":\"Introduction All mobile apps interact with servers in one way or another \\u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application's data or the server data.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/understanding-hmac-in-flutter-secure-api-requests-explained\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rahul-kumawat\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rahul-kumawat\\\/#author\"},\"datePublished\":\"2026-09-14T16:39:04+05:30\",\"dateModified\":\"2026-11-25T14:09:44+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog","description":"Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application's data or the server data.","canonical_url":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#article","name":"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog","headline":"Understanding HMAC in Flutter: Secure API Requests Explained","author":{"@id":"https:\/\/tothenew.xyz\/blog\/author\/rahul-kumawat\/#author"},"publisher":{"@id":"https:\/\/tothenew.xyz\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/tothenew.xyz\/blog\/wp-ttn-blog\/uploads\/2026\/09\/Setting_up_Flutter_project-300x83.png","@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#articleImage"},"datePublished":"2026-09-14T16:39:04+05:30","dateModified":"2026-11-25T14:09:44+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#webpage"},"isPartOf":{"@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#webpage"},"articleSection":"Android, APISecurity, authentication, BackendSecurity, Cryptography, Dart, Flutter, hmac, MobileSecurity, Networking"},{"@type":"BreadcrumbList","@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/tothenew.xyz\/blog#listItem","position":1,"name":"Home","item":"https:\/\/tothenew.xyz\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenew.xyz\/blog\/category\/android\/#listItem","name":"Android"}},{"@type":"ListItem","@id":"https:\/\/tothenew.xyz\/blog\/category\/android\/#listItem","position":2,"name":"Android","item":"https:\/\/tothenew.xyz\/blog\/category\/android\/","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#listItem","name":"Understanding HMAC in Flutter: Secure API Requests Explained"},"previousItem":{"@type":"ListItem","@id":"https:\/\/tothenew.xyz\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#listItem","position":3,"name":"Understanding HMAC in Flutter: Secure API Requests Explained","previousItem":{"@type":"ListItem","@id":"https:\/\/tothenew.xyz\/blog\/category\/android\/#listItem","name":"Android"}}]},{"@type":"Organization","@id":"https:\/\/tothenew.xyz\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/tothenew.xyz\/blog\/"},{"@type":"Person","@id":"https:\/\/tothenew.xyz\/blog\/author\/rahul-kumawat\/#author","url":"https:\/\/tothenew.xyz\/blog\/author\/rahul-kumawat\/","name":"Rahul Kumawat","image":{"@type":"ImageObject","@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/c1655ff4-ee52-4a67-a851-a0cfe81eaf5a_Rahul-Kumawat-Profile-Pitcure.jpeg","width":96,"height":96,"caption":"Rahul Kumawat"}},{"@type":"WebPage","@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#webpage","url":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/","name":"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog","description":"Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application's data or the server data.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/tothenew.xyz\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/#breadcrumblist"},"author":{"@id":"https:\/\/tothenew.xyz\/blog\/author\/rahul-kumawat\/#author"},"creator":{"@id":"https:\/\/tothenew.xyz\/blog\/author\/rahul-kumawat\/#author"},"datePublished":"2026-09-14T16:39:04+05:30","dateModified":"2026-11-25T14:09:44+05:30"},{"@type":"WebSite","@id":"https:\/\/tothenew.xyz\/blog\/#website","url":"https:\/\/tothenew.xyz\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/tothenew.xyz\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog","og:description":"Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application's data or the server data.","og:url":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/","og:image":"https:\/\/tothenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/tothenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Understanding HMAC in Flutter: Secure API Requests Explained | TO THE NEW Blog","twitter:description":"Introduction All mobile apps interact with servers in one way or another \u2014 sending requests for data, making form submissions, processing payments. While being a pathway of data exchange, this interaction can also pose as an entry point for hackers to enter in between and gain illegal access to Application's data or the server data.","twitter:image":"https:\/\/tothenew.xyz\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"81806","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2026-08-25 19:03:28","updated":"2026-11-25 08:39:46","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":{"subject":"","preview":"","content":""},"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenew.xyz\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenew.xyz\/blog\/category\/android\/\" title=\"Android\">Android<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tUnderstanding HMAC in Flutter: Secure API Requests Explained\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/tothenew.xyz\/blog"},{"label":"Android","link":"https:\/\/tothenew.xyz\/blog\/category\/android\/"},{"label":"Understanding HMAC in Flutter: Secure API Requests Explained","link":"https:\/\/tothenew.xyz\/blog\/understanding-hmac-in-flutter-secure-api-requests-explained\/"}],"_links":{"self":[{"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/81806","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/users\/2154"}],"replies":[{"embeddable":true,"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/comments?post=81806"}],"version-history":[{"count":9,"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/81806\/revisions"}],"predecessor-version":[{"id":84370,"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/posts\/81806\/revisions\/84370"}],"wp:attachment":[{"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/media?parent=81806"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/categories?post=81806"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tothenew.xyz\/blog\/wp-json\/wp\/v2\/tags?post=81806"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}