how basic authentication works in rest api