New version with auth and cookie saving the cookie in a file