First ofall find out scipt is getting gailed at which function from output logs and if it is the same function hich requires authentication, kindlu write web_set_user() function above the function which requires authentication. Also make a note provide proer arguments in web_set_user() function. provide used name with domain name, password, server ip:port no at which application is running.
cheers
aishwarya