I've been poking around the web looking for a solution to this, but I can't seem to find anything concrete. I have a site that has a non-Magento frontend. We're using the cart, checkout, and users from Magento only. We also have the Magento portion on a subdomain (i.e., store.domain.com), whereas the rest of the site has the standard 'www'.

Right now we're using the method where we include Mage.php and call Mage directly. We'd rather use the API across the board, though.

I have added my own methods for logging in, and they work, but subsequent calls to the api show that the user is no longer logged in:

public function __construct()
  // Change to the default store so we
  // can grab the frontend user session

  // Get the customer session
  $this->_session = Mage::getSingleton('customer/session');

public function login($email, $password)
  try {
    $passed = $this->_session->login($email, $password);
    if ($passed) {
      return $this->_session->getCustomerId();
    return false;
  catch (Exception $e) {

public function isLoggedIn()
  return $this->_session->isLoggedIn();

Has anyone successfully implemented logging in via the API?

  • You might have to return the session ID and use that every time you make a call. Never used the API, just my thought. – Rick Kuipers Apr 3 '13 at 17:01
  • 2
    Make sure that magento is writing cookies for JUST the domain itself and not the subdomain, it may be preventing the API from being read on wwww if the cookie subdomain is store.domain.com. – B00MER Apr 5 '13 at 0:19
  • Hey Ms. Folco, did you find a solution? – benmarks Sep 15 '13 at 17:24
  • we ended up going in an entirely different direction (by which i mean they decided to farm it out to offshore devs who will be creating their own home-grown PHP magento api). – Laura Sep 16 '13 at 17:57
  • Can you close the question? Either by adding your solution as an answer and accepting it or deleting the post – Sander Mangel Oct 9 '13 at 14:14

Please check out this post where OP is looking for a solution to get a users order data on a 3th party platform they've developed.

There are a couple of answers outlining oAuth as the way to do this. The frontend user will login to the underlying Magento environment granting the platform access to their data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.