refactor with base64 decoder for basic auth