modified version of auth example