[#248] Fix auth function