We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Stumped on how to automatically log someone in with php to a server-created account

Development and Programming

wondermade's avatar
wondermade
53 posts
14 years ago
wondermade's avatar wondermade

We’re looking to perform server-side login without any modules, etc. We’ve tried different PHP techniques, but get errors like “unauthorized request” (slight variation depending on what method we tried). We’re trying to do this in a regular php-enabled template using some of the hooks we saw in the dev documentation, but nothing seems to return. We are creating these users on the fly with SQL statements successfully, but we’re stumped on the login side. We can do this with ajax, but we’re trying to stay on the server side since we have so many dependancies related to {if logged in). (Ultimately we’re trying to generate anonymous account for live chat / favoriting and this is our best path there.)

Thanks for any help!

       
Jeremy Gimbel - Conflux Group's avatar
Jeremy Gimbel - Conflux Group
166 posts
14 years ago
Jeremy Gimbel - Conflux Group's avatar Jeremy Gimbel - Conflux Group

I doubt you’d be able to do this with a PHP enabled template. You’ll need a module with action IDs setup so you can expose endpoints to POST data to.

In the past, I’ve gone through the member module’s code and replicated the entire login procedure from there. As I recall it’s about 200 lines, but can be cut down significantly, if you go through it carefully. That’s the best way to see how EE is actually creating users’ sessions.

I did find this blog post, which may help. But when I was working on a similar project, the best way I found to figure out what to do was to look at some existing modules that do the same thing and see how they do it.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.