{"id":1073,"date":"2025-01-24T16:33:37","date_gmt":"2025-01-24T16:33:37","guid":{"rendered":"https:\/\/www.bleuio.com\/blog\/?p=1073"},"modified":"2025-03-07T22:09:50","modified_gmt":"2025-03-07T22:09:50","slug":"building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble","status":"publish","type":"post","link":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/","title":{"rendered":"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE)"},"content":{"rendered":"\n<p>Bluetooth Low Energy (BLE) provides a powerful mechanism to enhance security through proximity-based authentication. This tutorial showcases how to create a secure login system using Node.js, Express, and BLE technology. The project demonstrates how BLE scanning can verify the presence of an authorized BLE device (such as <strong><a href=\"https:\/\/www.closebeacon.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Close Beacon<\/a><\/strong>) in range before granting access. This offers an extra layer of protection for your applications.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why This Project?<\/h3>\n\n\n\n<p>With the increasing need for secure authentication mechanisms, BLE (Bluetooth Low Energy) offers a lightweight, reliable, and energy-efficient solution. This project demonstrates how you can utilize a <strong><a href=\"https:\/\/www.bleuio.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">BleuIO USB dongle <\/a><\/strong>to securely check the proximity of a specific Close Beacon&#8217;s mac address before granting access to sensitive resources.<\/p>\n\n\n\n<p><strong>Key Features:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Node.js Integration:<\/strong> Simplifies server-side logic using JavaScript.<\/li>\n\n\n\n<li><strong>BLE Device Scanning:<\/strong> Checks for the presence of an authorized device based on its MAC address.<\/li>\n\n\n\n<li><strong>Flexible Hardware Support:<\/strong> While this project uses <strong>Close Beacon<\/strong>, <strong>any BLE device<\/strong> can be used for authentication.<\/li>\n\n\n\n<li><strong>Enhanced Security:<\/strong> Adds an additional layer of security to the login process.<\/li>\n\n\n\n<li><strong>Practical Example:<\/strong> Serves as a foundation for more advanced BLE-based applications.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Practical Use Cases<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Extra Security Layer:<\/strong> Combine BLE proximity detection with traditional authentication methods for added security.<\/li>\n\n\n\n<li><strong>Access Control Systems:<\/strong> Enable access to sensitive areas only when an authorized device is nearby.<\/li>\n\n\n\n<li><strong>BLE-Powered IoT Applications:<\/strong> Use BleuIO for real-time device monitoring and communication.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Project Overview<\/h3>\n\n\n\n<p>This project uses:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Node.js<\/strong> for server-side scripting.<\/li>\n\n\n\n<li><strong>Express<\/strong> for handling routes and server logic.<\/li>\n\n\n\n<li><strong><a href=\"https:\/\/www.bleuio.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">BleuIO USB Dongle<\/a><\/strong> for BLE scanning.<\/li>\n\n\n\n<li><strong>A BLE Device (e.g., <a href=\"https:\/\/www.closebeacon.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Close Beacon<\/a>):<\/strong> Ensure the device is powered on and within range.<\/li>\n\n\n\n<li><strong>Bootstrap<\/strong> for a simple and clean UI.<\/li>\n<\/ul>\n\n\n\n<p>When the user clicks the &#8220;Login Securely&#8221; button, the application:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Connects to the BleuIO dongle via a serial port (tested on macOS; Windows code is commented in the source).<\/li>\n\n\n\n<li>Puts the dongle into <strong>central mode<\/strong> with the <code>AT+CENTRAL<\/code> command.<\/li>\n\n\n\n<li>Sets an RSSI filter (<code>AT+FRSSI=-56<\/code>) to filter out weak signals.<\/li>\n\n\n\n<li>Initiates a BLE scan for nearby devices (<code>AT+GAPSCAN=3<\/code>).<\/li>\n\n\n\n<li>Checks if a target device with a specific MAC address is present in the scan results.<\/li>\n\n\n\n<li>Logs the user into the dashboard if the device is nearby; otherwise, it denies access.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Setting Up the Project<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Prerequisites<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>BleuIO Dongle:<\/strong> Ensure the BleuIO dongle is plugged into your computer.<\/li>\n\n\n\n<li><strong>Node.js:<\/strong> Install Node.js from <a href=\"https:\/\/nodejs.org\">nodejs.org<\/a>.<\/li>\n\n\n\n<li><strong>Dependencies:<\/strong> Install <code>express<\/code> and <code>serialport<\/code> using npm:<br><code>npm install express serialport<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">How It Works<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 1: Frontend (HTML and JavaScript)<\/strong><\/h4>\n\n\n\n<p>The index page displays a button, &#8220;Login to dashboard securely.&#8221; When clicked, it sends a request to the server to scan for BLE devices.<\/p>\n\n\n\n<p><strong>index.html:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!-- index.html --&gt;\n&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n  &lt;head&gt;\n    &lt;meta charset=\"UTF-8\" \/&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/&gt;\n    &lt;link\n      href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.3.3\/dist\/css\/bootstrap.min.css\"\n      rel=\"stylesheet\"\n      integrity=\"sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH\"\n      crossorigin=\"anonymous\"\n    \/&gt;\n\n    &lt;title&gt;Login Securely&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;div class=\"container text-center mt-5\"&gt;\n      &lt;br \/&gt;\n      &lt;div class=\"row\"&gt;\n        &lt;div class=\"col-md-6 offset-md-3\"&gt;\n          &lt;p class=\"lead\"&gt;\n            This login checks if an authorized BLE device is nearby. The\n            &lt;strong&gt;BleuIO&lt;\/strong&gt;\n            dongle scans for the authorized device's MAC address. If it is\n            nearby, the system will log you into the dashboard.\n          &lt;\/p&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n\n      &lt;br \/&gt;\n      &lt;button class=\"btn btn-success btn-lg\" id=\"scanBtn\"&gt;\n        Login to dashboard securely\n      &lt;\/button&gt;\n      &lt;div id=\"listScan\"&gt;&lt;\/div&gt;\n    &lt;\/div&gt;\n\n    &lt;script&gt;\n      document.getElementById('scanBtn').addEventListener('click', () =&gt; {\n        fetch('\/scanbledevice')\n          .then((response) =&gt; response.json())\n          .then((data) =&gt; {\n            \/\/ Log the response for debugging\n            console.log(data.message);\n\n            \/\/ Redirect to \/dashboard if the device is nearby\n            if (data.success) {\n              window.location.href = '\/dashboard';\n            } else {\n              alert(data.message); \/\/ Show a message if the device is not nearby\n            }\n          })\n          .catch((err) =&gt; {\n            console.error('Error:', err);\n            alert('An error occurred while scanning for devices.');\n          });\n      });\n    &lt;\/script&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<p><strong>dashboard.html<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n  &lt;head&gt;\n    &lt;meta charset=\"UTF-8\" \/&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" \/&gt;\n    &lt;link\n      href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.3.3\/dist\/css\/bootstrap.min.css\"\n      rel=\"stylesheet\"\n      integrity=\"sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH\"\n      crossorigin=\"anonymous\"\n    \/&gt;\n    &lt;title&gt;Dashboard&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;div class=\"container\"&gt;\n      &lt;h3 class=\"mt-5\"&gt;Welcome to Smart Dashboard&lt;\/h3&gt;\n      &lt;br \/&gt;&lt;br \/&gt;\n      &lt;a href=\"\/\" class=\"btn btn-danger btn-lg\" id=\"logoutBtn\"&gt;Logout&lt;\/a&gt;\n    &lt;\/div&gt;\n    &lt;script&gt;\n      document\n        .getElementById('logoutBtn')\n        .addEventListener('click', (event) =&gt; {\n          event.preventDefault(); \/\/ Prevent default navigation\n          fetch('\/disconnect')\n            .then((response) =&gt; response.json())\n            .then((data) =&gt; {\n              if (data.success) {\n                console.log(data.message);\n                window.location.href = '\/'; \/\/ Redirect to the index page\n              } else {\n                alert('Failed to disconnect: ' + data.message);\n              }\n            })\n            .catch((err) =&gt; {\n              console.error('Error during disconnect:', err);\n              alert('An error occurred during logout.');\n            });\n        });\n    &lt;\/script&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 2: Backend Logic<\/strong><\/h4>\n\n\n\n<p>The server handles requests to scan for BLE devices, manage the serial port connection, and redirect users to the dashboard.<\/p>\n\n\n\n<p><strong>server.js:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ server.js\nconst express = require('express');\nconst { scanBLE, disconnectBLE } = require('.\/script');\n\nconst app = express();\nconst port = 3000;\n\n\/\/ Serve the HTML file\napp.get('\/', (req, res) =&gt; {\n  res.sendFile(__dirname + '\/index.html');\n});\napp.get('\/dashboard', (req, res) =&gt; {\n  res.sendFile(__dirname + '\/dashboard.html');\n});\napp.get('\/disconnect', (req, res) =&gt; {\n  disconnectBLE()\n    .then((message) =&gt; {\n      res.json({ success: true, message });\n    })\n    .catch((err) =&gt; {\n      console.error('Error during disconnect:', err);\n      res\n        .status(500)\n        .json({ success: false, message: 'Failed to disconnect serial port' });\n    });\n});\n\n\/\/ Endpoint to fetch the list of serial ports\napp.get('\/scanbledevice', (req, res) =&gt; {\n  scanBLE()\n    .then((bleDevice) =&gt; {\n      const targetMacAddress = '&#91;1]D1:79:29:DB:CB:CC';\n\n      \/\/ Check if the target device is nearby\n      const isNearby = bleDevice.some((line) =&gt;\n        line.includes(targetMacAddress)\n      );\n\n      \/\/ Respond with a message\n      if (isNearby) {\n        res.json({\n          success: true,\n          message: `Device ${targetMacAddress} is nearby.`,\n        });\n      } else {\n        res.json({\n          success: false,\n          message: `Login Failed ! Device ${targetMacAddress} is not nearby.`,\n        });\n      }\n    })\n    .catch((err) =&gt; {\n      console.error('Error during BLE scan:', err);\n      res\n        .status(500)\n        .json({ success: false, message: 'Error fetching BLE devices.' });\n    });\n});\n\n\/\/ Start the server\napp.listen(port, () =&gt; {\n  console.log(`Server is running on http:\/\/localhost:${port}`);\n});\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 3: BLE Scanning Logic<\/strong><\/h4>\n\n\n\n<p>The script connects to the BleuIO dongle, configures it, and scans for nearby devices.<\/p>\n\n\n\n<p><strong>script.js:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ script.js\nconst { SerialPort } = require('serialport');\nvar firstPort = '';\nvar readDataArray = &#91;];\nvar openPort;\n\/\/ Function to fetch the ble device list\nfunction scanBLE() {\n  return new Promise((resolve, reject) =&gt; {\n    SerialPort.list()\n      .then((ports) =&gt; {\n        \/\/filter ports to get BleuIO path\n        \/\/ windows\n        \/* result = ports.filter(\n            (portVal) =&gt;\n              portVal.pnpId &amp;&amp; portVal.pnpId.includes(\"VID_2DCF&amp;PID_6002\")\n          ); *\/\n        \/\/Mac\n        result = ports.filter(\n          (portVal) =&gt;\n            portVal.manufacturer &amp;&amp;\n            portVal.manufacturer.includes('Smart Sensor Devices')\n        );\n        \/\/ get the first port path of the BleuIO connected to computer\n        firstPort = result&#91;0] &amp;&amp; result&#91;0].path;\n        openPort = new SerialPort({ path: firstPort, baudRate: 115200 });\n        \/\/ function to read serial port data\n        const readData = (dm) =&gt; {\n          return new Promise((resolve, reject) =&gt; {\n            openPort.on('readable', () =&gt; {\n              let data = openPort.read();\n              let enc = new TextDecoder();\n              let arr = new Uint8Array(data);\n              let rawString = enc.decode(arr);\n\n              \/\/ Split response into lines and trim extra spaces or empty lines\n              let lines = rawString\n                .split(\/&#91;\\r\\n]+\/)\n                .filter((line) =&gt; line.trim() !== '');\n              readDataArray.push(...lines);\n\n              \/\/ Log each line for better readability\n              lines.forEach((line) =&gt; console.log(line));\n\n              if (rawString.includes(dm)) {\n                return resolve(readDataArray);\n              } else {\n                return resolve(readDataArray);\n              }\n            });\n          });\n        };\n\n        \/\/ put the dongle to central role\n        openPort.write('AT+CENTRAL\\r', (err) =&gt; {\n          if (err) {\n            return reject(\n              new Error('Error setting dongle to central role ' + err.message)\n            );\n          } else {\n            \/\/ Set the RSSI filter\n            openPort.write('AT+FRSSI=-56\\r', (err) =&gt; {\n              if (err) {\n                return reject(\n                  new Error('Error setting RSSI filter ' + err.message)\n                );\n              } else {\n                \/\/ Scan for BLE devices for three seconds\n                openPort.write('AT+GAPSCAN=3\\r', (err) =&gt; {\n                  if (err) {\n                    return reject(\n                      new Error('Error initiating BLE scan ' + err.message)\n                    );\n                  } else {\n                    setTimeout(() =&gt; {\n                      resolve(readData('SCAN COMPLETE'));\n                    }, 3500);\n                  }\n                });\n              }\n            });\n          }\n        });\n      })\n      .catch((err) =&gt; {\n        console.error('Error listing serial ports:', err);\n        reject(err);\n      });\n  });\n}\nfunction disconnectBLE() {\n  return new Promise((resolve, reject) =&gt; {\n    if (openPort &amp;&amp; openPort.isOpen) {\n      openPort.close((err) =&gt; {\n        if (err) {\n          console.error('Error closing serial port:', err);\n          return reject(err);\n        }\n        console.log('Serial port disconnected.');\n        resolve('Disconnected');\n      });\n    } else {\n      console.log('No serial port to disconnect.');\n      resolve('No port to disconnect');\n    }\n  });\n}\n\nmodule.exports = { scanBLE, disconnectBLE };\n<\/code><\/pre>\n\n\n\n<p>Full source code is available at github. <strong><a href=\"https:\/\/github.com\/smart-sensor-devices-ab\/secure_login_example_bleuIO\" target=\"_blank\" rel=\"noreferrer noopener\">Source code <\/a><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Output<\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE)\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/GzbgF3HkW7Q?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-image size-large is-resized border\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"421\" src=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-3-1024x421.png\" alt=\"\" class=\"wp-image-1074\" style=\"width:569px;height:auto\" srcset=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-3-1024x421.png 1024w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-3-300x123.png 300w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-3-768x316.png 768w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-3-1536x632.png 1536w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-3.png 1560w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-image size-large is-resized border\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"547\" src=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-4-1024x547.png\" alt=\"\" class=\"wp-image-1075\" style=\"width:480px;height:auto\" srcset=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-4-1024x547.png 1024w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-4-300x160.png 300w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-4-768x411.png 768w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-4.png 1126w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<figure class=\"wp-block-image size-large is-resized border\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"527\" src=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-5-1024x527.png\" alt=\"\" class=\"wp-image-1076\" style=\"width:474px;height:auto\" srcset=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-5-1024x527.png 1024w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-5-300x154.png 300w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-5-768x395.png 768w, https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/image-5.png 1426w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This project is an example of how to integrate BleuIO with Node.js to build a BLE-powered secure login system. The source code is available and can be adapted for your use case. Start experimenting with BleuIO today and unlock the potential of BLE in your applications!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bluetooth Low Energy (BLE) provides a powerful mechanism to enhance security through proximity-based authentication. This tutorial showcases how to create a secure login system using Node.js, Express, and BLE technology. The project demonstrates how BLE scanning can verify the presence of an authorized BLE device (such as Close Beacon) in range before granting access. This [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1194,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2],"tags":[],"class_list":["post-1073","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-bleuio","category-bleuio-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE) - BleuIO - Create Bluetooth Low Energy application<\/title>\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.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE) - BleuIO - Create Bluetooth Low Energy application\" \/>\n<meta property=\"og:description\" content=\"Bluetooth Low Energy (BLE) provides a powerful mechanism to enhance security through proximity-based authentication. This tutorial showcases how to create a secure login system using Node.js, Express, and BLE technology. The project demonstrates how BLE scanning can verify the presence of an authorized BLE device (such as Close Beacon) in range before granting access. This [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/\" \/>\n<meta property=\"og:site_name\" content=\"BleuIO - Create Bluetooth Low Energy application\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-24T16:33:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-07T22:09:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/bluetooth-security-.png\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"BleuIO\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/\"},\"author\":{\"name\":\"BleuIO\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\"},\"headline\":\"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE)\",\"datePublished\":\"2025-01-24T16:33:37+00:00\",\"dateModified\":\"2025-03-07T22:09:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/\"},\"wordCount\":541,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/bluetooth-security-.png\",\"articleSection\":[\"BleuIO\",\"BleuIO tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/\",\"name\":\"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE) - BleuIO - Create Bluetooth Low Energy application\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/bluetooth-security-.png\",\"datePublished\":\"2025-01-24T16:33:37+00:00\",\"dateModified\":\"2025-03-07T22:09:50+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/bluetooth-security-.png\",\"contentUrl\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/wp-content\\\/uploads\\\/2025\\\/01\\\/bluetooth-security-.png\",\"width\":750,\"height\":450,\"caption\":\"bluetooth security\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/\",\"name\":\"BleuIO - Create Bluetooth Low Energy application\",\"description\":\"Learn Bluetooth Low Energy programming and build Bluetooth Low Energy Application\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/#\\\/schema\\\/person\\\/89bc581382d5964043f96efc54b75b80\",\"name\":\"BleuIO\",\"sameAs\":[\"https:\\\/\\\/www.bleuio.com\\\/blog\"],\"url\":\"https:\\\/\\\/www.bleuio.com\\\/blog\\\/author\\\/biadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE) - BleuIO - Create Bluetooth Low Energy application","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.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/","og_locale":"en_US","og_type":"article","og_title":"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE) - BleuIO - Create Bluetooth Low Energy application","og_description":"Bluetooth Low Energy (BLE) provides a powerful mechanism to enhance security through proximity-based authentication. This tutorial showcases how to create a secure login system using Node.js, Express, and BLE technology. The project demonstrates how BLE scanning can verify the presence of an authorized BLE device (such as Close Beacon) in range before granting access. This [&hellip;]","og_url":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/","og_site_name":"BleuIO - Create Bluetooth Low Energy application","article_published_time":"2025-01-24T16:33:37+00:00","article_modified_time":"2025-03-07T22:09:50+00:00","og_image":[{"width":750,"height":450,"url":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/bluetooth-security-.png","type":"image\/png"}],"author":"BleuIO","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#article","isPartOf":{"@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/"},"author":{"name":"BleuIO","@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80"},"headline":"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE)","datePublished":"2025-01-24T16:33:37+00:00","dateModified":"2025-03-07T22:09:50+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/"},"wordCount":541,"commentCount":0,"image":{"@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/bluetooth-security-.png","articleSection":["BleuIO","BleuIO tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/","url":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/","name":"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE) - BleuIO - Create Bluetooth Low Energy application","isPartOf":{"@id":"https:\/\/www.bleuio.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#primaryimage"},"image":{"@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#primaryimage"},"thumbnailUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/bluetooth-security-.png","datePublished":"2025-01-24T16:33:37+00:00","dateModified":"2025-03-07T22:09:50+00:00","author":{"@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80"},"breadcrumb":{"@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#primaryimage","url":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/bluetooth-security-.png","contentUrl":"https:\/\/www.bleuio.com\/blog\/wp-content\/uploads\/2025\/01\/bluetooth-security-.png","width":750,"height":450,"caption":"bluetooth security"},{"@type":"BreadcrumbList","@id":"https:\/\/www.bleuio.com\/blog\/building-a-secure-proximity-based-login-system-with-bluetooth-low-energy-ble\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.bleuio.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Building a Secure Proximity-Based Login System with Bluetooth Low Energy (BLE)"}]},{"@type":"WebSite","@id":"https:\/\/www.bleuio.com\/blog\/#website","url":"https:\/\/www.bleuio.com\/blog\/","name":"BleuIO - Create Bluetooth Low Energy application","description":"Learn Bluetooth Low Energy programming and build Bluetooth Low Energy Application","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bleuio.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.bleuio.com\/blog\/#\/schema\/person\/89bc581382d5964043f96efc54b75b80","name":"BleuIO","sameAs":["https:\/\/www.bleuio.com\/blog"],"url":"https:\/\/www.bleuio.com\/blog\/author\/biadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/1073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/comments?post=1073"}],"version-history":[{"count":12,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/1073\/revisions"}],"predecessor-version":[{"id":1196,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/posts\/1073\/revisions\/1196"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/media\/1194"}],"wp:attachment":[{"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/media?parent=1073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/categories?post=1073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bleuio.com\/blog\/wp-json\/wp\/v2\/tags?post=1073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}