With a little more info about the REQUEST/RESPONSE sequences, I think I can help. Your post is kind of unclear... (How do I post a question effectively?)
1. use WWW::Mechanize (no need for Firefox specifics, I don't think. Its ok to use Firebug to "discover" how to automate a process, but it doesnt' really tie you to firefox after that point)
2. you seem to indicate you are able to pull the new, random URL you need from sso.gen??
*If* #2 is true, or at least close to reality, you should be able to parse that random URL and load it through a second GET request (I think that is what you are asking for in #3??)