title: What is a simple and secure way to transmit a login key from one website to another while redirecting a user?
body: <p>I want to create a portal website for log-in, news and user management.  And another web site for a web app that the portal redirects to after login.</p>
  
  <p>One of my goals is to be able to host the portal and web-app on different servers.  The portal would transmit the user's id to the web-app, once the user had successfully logged in and been redirected to the web app.  But I don't want people to be able to just bypass the login, or access other users accounts, by transmitting user ids straight to the web app.</p>
  
  <p>My first thought is to transmit the user id encrypted as a post variable or query string value.  Using some kind of public/private key scenario, and adding a DateTime stamp to key to make it vary everytime.</p>
  
  <p>But I haven't done this kind of thing before, so I'm wondering if there aren't better ways to do this. </p>
  
  <p>(I could potentially communicate via database, by having the portal store the user id with a key in a database and passing that key to the web app which uses it to get the user id from that database.  But that seems crazy.)</p>
  
  <p>Can anyone give a way to do this or advice?  Or is this a bad idea all-together?</p>
  
  <p>Thanks for your time.</p>