How do I load a game with a user already logged in?

Get help using Construct 2

Post » Thu Mar 12, 2015 11:21 am

I'm looking to build an app that resides inside an iframe on a larger webpage. I would like to handle user authentication on the larger webpage, and then pass the username/password to the Construct 2 app in the iframe when it loads.

I was considering the following possibilities:
1. Store the authentication information as a php session variable, then modify the Construct 2 index.html to become index.php and load the username and password as javascript variables.
2. Pass the authentication information via a GET request to the Construct 2 index.html (renamed as index.php) and load the username and password as javascript variables.

In either case, I need to somehow create a javascript variable that Construct 2 will recognize in-game.

Any ideas? Can this even be done?

Thanks for your help!
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
47
S
13
G
20
Posts: 371
Reputation: 14,445

Post » Thu Mar 12, 2015 2:26 pm

If its a php based backend, could you not simply do a get request with ajax to a php file residing on the same server, retrieving the currently logged in user and whatever else is needed ?

If I am not mistaken, it would be the same session.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Thu Mar 12, 2015 5:28 pm

@lennaert,

I think you are right. I'm not sure why I didn't think of that, but I will give it a shot.

Thanks for the help!
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
47
S
13
G
20
Posts: 371
Reputation: 14,445


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, MikaelS, nahima and 20 guests