{"id":8930,"date":"2026-08-06T14:54:24","date_gmt":"2026-08-06T12:54:24","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?page_id=8930"},"modified":"2026-08-06T14:58:01","modified_gmt":"2026-08-06T12:58:01","slug":"authentication-basic-auth-htpasswd-generator","status":"publish","type":"page","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/","title":{"rendered":"Authentication: Basic Auth + htpasswd Generator"},"content":{"rendered":"<div id=\"auth-tool-wrapper\" style=\"max-width: 100%; background: #1e293b; color: #f8fafc; padding: 28px; border-radius: 12px; font-family: system-ui, -apple-system, sans-serif; box-shadow: 0 4px 20px rgba(0,0,0,0.3); border: 1px solid #334155;\">\n<p>    <!-- Privacy Notice Banner --><\/p>\n<div style=\"display: flex; align-items: center; gap: 12px; background: rgba(56, 189, 248, 0.08); border: 1px solid rgba(56, 189, 248, 0.2); padding: 12px 16px; border-radius: 8px; margin-bottom: 24px; font-size: 0.85rem; color: #38bdf8; line-height: 1.4;\">\n        <svg style=\"width: 20px; height: 20px; flex-shrink: 0;\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" viewBox=\"0 0 24 24\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z\"><\/path><\/svg><br \/>\n        <span><strong>Privacy Guarantee:<\/strong> No data entered here is stored on my server or transferred anywhere else. Everything runs 100% locally in your browser.<\/span>\n    <\/div>\n<div style=\"display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px;\">\n<div>\n            <label style=\"display: block; font-size: 0.875rem; margin-bottom: 8px; color: #cbd5e1; font-weight: 500;\">Username<\/label><br \/>\n            <input type=\"text\" id=\"auth-user\" placeholder=\"e.g. api_user\" style=\"width: 100%; padding: 12px; background: #0f172a; border: 1px solid #475569; color: #fff; border-radius: 8px; box-sizing: border-box; outline: none; transition: border-color 0.2s, box-shadow 0.2s;\" onfocus=\"this.style.borderColor='#38bdf8'; this.style.boxShadow='0 0 0 3px rgba(56,189,248,0.15)'\" onblur=\"this.style.borderColor='#475569'; this.style.boxShadow='none'\">\n        <\/div>\n<div>\n            <label style=\"display: block; font-size: 0.875rem; margin-bottom: 8px; color: #cbd5e1; font-weight: 500;\">Password<\/label><br \/>\n            <input type=\"text\" id=\"auth-pass\" placeholder=\"e.g. SecretPassword123\" style=\"width: 100%; padding: 12px; background: #0f172a; border: 1px solid #475569; color: #fff; border-radius: 8px; box-sizing: border-box; outline: none; transition: border-color 0.2s, box-shadow 0.2s;\" onfocus=\"this.style.borderColor='#38bdf8'; this.style.boxShadow='0 0 0 3px rgba(56,189,248,0.15)'\" onblur=\"this.style.borderColor='#475569'; this.style.boxShadow='none'\">\n        <\/div>\n<\/p><\/div>\n<p>    <button id=\"auth-generate-btn\" style=\"width: 100%; background: #0284c7; color: white; border: none; padding: 12px; font-weight: 600; font-size: 0.95rem; border-radius: 8px; cursor: pointer; transition: background 0.2s, transform 0.1s;\" onmouseover=\"this.style.background='#0369a1'\" onmouseout=\"this.style.background='#0284c7'\" onmousedown=\"this.style.transform='scale(0.99)'\" onmouseup=\"this.style.transform='scale(1)'\">Generate Credentials<\/button><\/p>\n<div style=\"margin-top: 24px; display: flex; flex-direction: column; gap: 16px;\">\n        <!-- .htpasswd Output --><\/p>\n<div>\n<div style=\"display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;\">\n                <label style=\"font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;\">1. .htpasswd File Entry (SHA)<\/label><br \/>\n                <button onclick=\"copyToClipboard('out-htpasswd', this)\" style=\"background: rgba(71, 85, 105, 0.4); border: 1px solid #475569; color: #cbd5e1; padding: 3px 10px; font-size: 0.75rem; border-radius: 4px; cursor: pointer; transition: all 0.2s;\" onmouseover=\"this.style.background='#475569'; this.style.color='#fff'\" onmouseout=\"this.style.background='rgba(71, 85, 105, 0.4)'; this.style.color='#cbd5e1'\">Copy<\/button>\n            <\/div>\n<p>            <input type=\"text\" id=\"out-htpasswd\" readonly style=\"width: 100%; padding: 11px 12px; background: #0f172a; border: 1px solid #334155; color: #38bdf8; font-family: monospace; font-size: 0.9rem; border-radius: 6px; box-sizing: border-box;\" placeholder=\"[username]:{SHA}[hash]\">\n        <\/div>\n<p>        <!-- Basic Auth Header Output --><\/p>\n<div>\n<div style=\"display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;\">\n                <label style=\"font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;\">2. HTTP Header (Authorization: Basic)<\/label><br \/>\n                <button onclick=\"copyToClipboard('out-header', this)\" style=\"background: rgba(71, 85, 105, 0.4); border: 1px solid #475569; color: #cbd5e1; padding: 3px 10px; font-size: 0.75rem; border-radius: 4px; cursor: pointer; transition: all 0.2s;\" onmouseover=\"this.style.background='#475569'; this.style.color='#fff'\" onmouseout=\"this.style.background='rgba(71, 85, 105, 0.4)'; this.style.color='#cbd5e1'\">Copy<\/button>\n            <\/div>\n<p>            <input type=\"text\" id=\"out-header\" readonly style=\"width: 100%; padding: 11px 12px; background: #0f172a; border: 1px solid #334155; color: #38bdf8; font-family: monospace; font-size: 0.9rem; border-radius: 6px; box-sizing: border-box;\" placeholder=\"Basic [base64_credentials]\">\n        <\/div>\n<p>        <!-- cURL Example Output --><\/p>\n<div>\n<div style=\"display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;\">\n                <label style=\"font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;\">3. cURL Test Command<\/label><br \/>\n                <button onclick=\"copyToClipboard('out-curl', this)\" style=\"background: rgba(71, 85, 105, 0.4); border: 1px solid #475569; color: #cbd5e1; padding: 3px 10px; font-size: 0.75rem; border-radius: 4px; cursor: pointer; transition: all 0.2s;\" onmouseover=\"this.style.background='#475569'; this.style.color='#fff'\" onmouseout=\"this.style.background='rgba(71, 85, 105, 0.4)'; this.style.color='#cbd5e1'\">Copy<\/button>\n            <\/div>\n<p>            <input type=\"text\" id=\"out-curl\" readonly style=\"width: 100%; padding: 11px 12px; background: #0f172a; border: 1px solid #334155; color: #38bdf8; font-family: monospace; font-size: 0.9rem; border-radius: 6px; box-sizing: border-box;\" placeholder=\"curl -u &quot;user:pass&quot; https:\/\/...\">\n        <\/div>\n<\/p><\/div>\n<\/div>\n<p><script>\nasync function generateAuthData() {\n    const user = document.getElementById('auth-user').value.trim();\n    const pass = document.getElementById('auth-pass').value.trim();<\/p>\n<p>    if (!user || !pass) {\n        alert('Please enter both username and password.');\n        return;\n    }<\/p>\n<p>    const encoder = new TextEncoder();\n    const data = encoder.encode(pass);\n    const hashBuffer = await crypto.subtle.digest('SHA-1', data);\n    const hashArray = Array.from(new Uint8Array(hashBuffer));\n    const base64Hash = btoa(String.fromCharCode.apply(null, hashArray));<\/p>\n<p>    document.getElementById('out-htpasswd').value = `${user}:{SHA}${base64Hash}`;<\/p>\n<p>    const basicCreds = btoa(`${user}:${pass}`);\n    document.getElementById('out-header').value = `Basic ${basicCreds}`;<\/p>\n<p>    document.getElementById('out-curl').value = `curl -u \"${user}:${pass}\" https:\/\/your-domain.com\/endpoint`;\n}<\/p>\n<p>document.getElementById('auth-generate-btn').addEventListener('click', generateAuthData);\ndocument.getElementById('auth-pass').addEventListener('keypress', function (e) {\n    if (e.key === 'Enter') generateAuthData();\n});<\/p>\n<p>function copyToClipboard(elementId, btnElement) {\n    const copyText = document.getElementById(elementId);\n    if (!copyText.value) return;<\/p>\n<p>    navigator.clipboard.writeText(copyText.value).then(() => {\n        const originalText = btnElement.innerText;\n        btnElement.innerText = 'Copied!';\n        btnElement.style.color = '#38bdf8';\n        btnElement.style.borderColor = '#38bdf8';\n        btnElement.style.background = 'rgba(56, 189, 248, 0.1)';\n        setTimeout(() => {\n            btnElement.innerText = originalText;\n            btnElement.style.color = '#cbd5e1';\n            btnElement.style.borderColor = '#475569';\n            btnElement.style.background = 'rgba(71, 85, 105, 0.4)';\n        }, 1500);\n    });\n}\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Privacy Guarantee: No data entered here is stored on my server or transferred anywhere else. Everything runs 100% locally in your browser. Username Password Generate Credentials 1. .htpasswd File Entry (SHA) Copy 2. HTTP Header (Authorization: Basic) Copy 3. cURL Test Command Copy<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":38,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template-tool-base.php","meta":{"footnotes":""},"class_list":["post-8930","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Authentication: Basic Auth + htpasswd Generator - Lukas Wojcik - Blog<\/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.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Authentication: Basic Auth + htpasswd Generator - Lukas Wojcik - Blog\" \/>\n<meta property=\"og:description\" content=\"Privacy Guarantee: No data entered here is stored on my server or transferred anywhere else. Everything runs 100% locally in your browser. Username Password Generate Credentials 1. .htpasswd File Entry (SHA) Copy 2. HTTP Header (Authorization: Basic) Copy 3. cURL Test Command Copy\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-06T12:58:01+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/toolbox\\\/authentication-basic-auth-htpasswd-generator\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/toolbox\\\/authentication-basic-auth-htpasswd-generator\\\/\",\"name\":\"Authentication: Basic Auth + htpasswd Generator - Lukas Wojcik - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"datePublished\":\"2026-08-06T12:54:24+00:00\",\"dateModified\":\"2026-08-06T12:58:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/toolbox\\\/authentication-basic-auth-htpasswd-generator\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/toolbox\\\/authentication-basic-auth-htpasswd-generator\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/toolbox\\\/authentication-basic-auth-htpasswd-generator\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Toolbox\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/toolbox\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Authentication: Basic Auth + htpasswd Generator\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"luky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"luky\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Authentication: Basic Auth + htpasswd Generator - Lukas Wojcik - Blog","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.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/","og_locale":"en_US","og_type":"article","og_title":"Authentication: Basic Auth + htpasswd Generator - Lukas Wojcik - Blog","og_description":"Privacy Guarantee: No data entered here is stored on my server or transferred anywhere else. Everything runs 100% locally in your browser. Username Password Generate Credentials 1. .htpasswd File Entry (SHA) Copy 2. HTTP Header (Authorization: Basic) Copy 3. cURL Test Command Copy","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/","og_site_name":"Lukas Wojcik - Blog","article_modified_time":"2026-08-06T12:58:01+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/","name":"Authentication: Basic Auth + htpasswd Generator - Lukas Wojcik - Blog","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"datePublished":"2026-08-06T12:54:24+00:00","dateModified":"2026-08-06T12:58:01+00:00","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/authentication-basic-auth-htpasswd-generator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Toolbox","item":"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/"},{"@type":"ListItem","position":3,"name":"Authentication: Basic Auth + htpasswd Generator"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"luky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"luky"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/pages\/8930","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=8930"}],"version-history":[{"count":3,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/pages\/8930\/revisions"}],"predecessor-version":[{"id":8933,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/pages\/8930\/revisions\/8933"}],"up":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/pages\/38"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=8930"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}