Passing Information Between Web Apps

Here we go… Everybody is always so helpful and I love being a part of this community. Im still new to programming web apps. I am trying to make an idea work for an accounting program. There is going to be multiple apps. I need to pass information between the apps running on Xojo Cloud. There’s no way around making the apps separate so the only option is to make several apps act seamlessly and appear as one. What is the best way to pass information between two different web apps? For the time being, all i need to do is pass a few strings between the apps. I thought initially that setting a cookie was the way to go but the information is gone when I try to read it in the second app. Any advice would be greatly appreciated.

Both apps would need to be running on the same subdomain and port, which I don’t think is possible, or you can try setting the domain attribute to allow all subdomains (note the leading dot in the domain):

Set-Cookie: foo=bar; domain=.example.com

Do the users have some sort of common user identifier on the two apps? Could you pass this information through a shared sqlite database?

You should look into IPCSocket. It is meant to exchange data between programs.
http://documentation.xojo.com/api/networking/ipcsocket.html

You could also use HandleURL, but it may require a little more efforts.
http://documentation.xojo.com/api/web/webapplication.html#webapplication-handleurl

Perhaps this will give you some ideas:

link text

When the user logs into the main app it creates a session database. The session database is unique to the user and it stores all their registration information. Each user has a registration number. However, for that registration number there can be multiple sessions logging in. This is for accounting for schools in Montana. Sometimes the clerk logs in, sometimes the assistant, sometimes the principle and sometimes at the same time. So a second session database is created for the each user on the registration that is currently logged in.

For right now, when i get to the second program I just need to know which session database to read so that I know which user Im dealing with. When I reach the second program, the user is already logged in and I know this because it created the session database when login was validated. In the second program, I just gotta load the correct session database so I need to be able to pass the session database name to the second program.

Assuming that you have to break up the web application (don’t do this just for load balancing), and assuming that you want the user to click something and transition from web app A to B without having to log back in or even really noticing the backend hop between Xojo web apps…

  1. You can give each app its own subdomain and use Andrew Lambert’s suggestion to share a cookie among all of them. I would not pass real data that way. I would use a randomly generated token that the apps could use to identify the correct user session (which of course is distinct from a Xojo WebSession on a given app instance). Use an underlying server database to store/share the real data.

  2. You could use a URL parameter to identify the correct user session. The origin app would generate the correct URL on the fly for the current user and the destination app would intercept this URL via HandleURL. If valid the destination app could then redirect to a regular Xojo Web session/page having set the information necessary for that session to know who it is.

In this case you would want to be cautions about security. Again, I would use a randomly generated token. I would apply a time limit to those tokens and force the user to log back in if outside that limit, or if the user logged out on app A before the URL was received by app B. And I would probably force the user to log back in if the source IP address did not match (i.e. app A recorded 1.1.1.1 with the token, but app B got the token from 1.1.1.2).

I don’t think any type of IPC would apply here, though IPC solutions would apply to something like a chat site with multiple Xojo web app instances running concurrently.

[quote=480185:@Daniel Taylor]Assuming that you have to break up the web application (don’t do this just for load balancing), and assuming that you want the user to click something and transition from web app A to B without having to log back in or even really noticing the backend hop between Xojo web apps…

  1. You can give each app its own subdomain and use Andrew Lambert’s suggestion to share a cookie among all of them. I would not pass real data that way. I would use a randomly generated token that the apps could use to identify the correct user session (which of course is distinct from a Xojo WebSession on a given app instance). Use an underlying server database to store/share the real data.

  2. You could use a URL parameter to identify the correct user session. The origin app would generate the correct URL on the fly for the current user and the destination app would intercept this URL via HandleURL. If valid the destination app could then redirect to a regular Xojo Web session/page having set the information necessary for that session to know who it is.

In this case you would want to be cautions about security. Again, I would use a randomly generated token. I would apply a time limit to those tokens and force the user to log back in if outside that limit, or if the user logged out on app A before the URL was received by app B. And I would probably force the user to log back in if the source IP address did not match (i.e. app A recorded 1.1.1.1 with the token, but app B got the token from 1.1.1.2).

I don’t think any type of IPC would apply here, though IPC solutions would apply to something like a chat site with multiple Xojo web app instances running concurrently.[/quote]

Wow Daniel! Thank you so much for taking the time to lay a few things out. I was just working out the details for the second solution just as you described. I generated a random token and use that to pass between the programs using URL parameter so when it gets to program B it auto logs in without notice. Looks like I’m right on track.

I had another question under the topic ‘Session Problem’I believe. If you get a chance would you mind looking at it. Sounds like you done similar stuff before so it’s helpful. Thanks again.