🔑JWT & Auth

HTTP Basic Auth

Old-school username:password encoding for headers.

Explanation

Basic auth is simple but requires the credentials to be sent with every request, encoded in Base64.

Examples

Header
Output
Authorization: Basic dXNlcjpwYXNz

Code Examples

JavaScript
const credentials = btoa('username:password');
const header = 'Authorization: Basic ' + credentials;

💡 Tips

  • Only use over HTTPS as credentials are not encrypted
  • Good for internal APIs or simple prototypes
  • Format is always username:password

⚠️ Common Pitfalls

  • Credentials remain in memory/browser cache more easily than tokens