JSFiddle - React, Tailwind, and code Playground

by Stephen Katulka

HTML

<body>
    
</body>

JavaScript

var getAuthToken = function(user, pass){
    var token = "";
    if (user){
        token += encodeURIComponent(user);
    }
    if (pass){
        token += ":" + encodeURIComponent(pass);   
    }
    return "Basic " + $.base64.encode(token);
}

$(document).onReady(function(){
    alert(getAuthToken("[email protected]","Password123");                
});