I'm trying to do the same with some success. I haven't finished my module yet but it is half way there.
Basically, I set my username and password as variables which can be set in the module or the values can be added into the app.
Then in my module I simply have:
At the moment, I'm just using this to create an output file and use it in LOAD script immediately after.
I use Webtrends OnPremise but I guess it would be more or less the same for Ondemand
Hope this helps