HTML form to Flex application
===

I have an integration problem between an HTML and a Flex application.

I have a Flex application that exists on a domain, let's say http://www.onedomain.com/. The application requires the user to login from a user, password input built in Flex - The user information is stored in a database that the Flex application query through php.

Now I want to build an external login from a html form. This form is a part of a site on let's say the domain http://www.otherdomain.com/. I want to be able to fill in the user information on the 'otherdomain', send him/her to 'onedomain' with POST variables and make the Flex application use the credentials and login the user in the application.

How can I implement this in a secure way?

I don't want to e.g. store the username and password plainly in flashvars. I can login the user before the Flex application. So it would be possible to e.g. login the user, get perhaps some token from the server that could be passed to the flex application, and then check that the token is right according to the server from a Flex call.

What should I do?