"Fake" an auto-login

skaulana
skaulana's picture

Joined: 2006-07-30
Posts: 4
Posted: Sun, 2006-10-01 18:20

Hi everyone,

Seems like a recurring topic (at least on the g1 forums) is how to integrate G2's login system with a minimum amount of effort. Some solutions had been proposed, most of which don't seem relevant to G2 anymore. I thought I had come up with a simpler solution that theoretically seemed like it should work, but wouldn't.

Anyway, the question: what's wrong with faking the login's postback by hard coding the $_POST variables into, say, index.php? The desired effect would be an automatic login, done as if G2 had actually been logged into... but it doesn't work, and I don't understand why.

More details in this thread I opened to the same effect. Someone suggested it was out of the range of customization and I should try asking integration folks. Any thoughts?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2006-10-02 12:21

GalleryEmbed (see modules/core/classes/GalleryEmbed.class) assumes that you map the userIds of your application with the userIds of the users in G2.
We call the userId in your application activeUserId or externalUserId.

You can manually add a single entry to the Gallery's ExternalIdMap database table and map it to the g_id of g2's administrator user.

then you can login by including embed.php and calling GalleryEmbed::init(array('activeUserId' => 'the_id_you_chose', ...));

for more information and code snippets / examples, see:
http://codex.gallery2.org/index.php/Gallery2:Embedding:Integration#An_entry_point