I would suggest that is not the way to do it.
Build a two-way web service, redirect to Moodle and pass a one-time token or similar. The Moodle session cookies don't hold anything terribly useful so you'll have big problems doing it your way.
Or possibly use a standard authentication mechanism but those are often total overkill.