I want create login functionality outside magento, but same server. For this I created a login form, but without correct form key it is useless.
Is there way to get customer login form key?
Here is my code. But it gives different key
<?php
require 'store/app/Mage.php';
Mage::app();
// Define the path to the root of Magento installation.
define('ROOT', Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
// Obtain the general session and search for an item called 'customer_id'
$coreSession = Mage::getSingleton('core/session', array('name' => 'frontend'));
$key = Mage::getSingleton('core/session')->getFormKey();
?>
<form action="mydomain/store/customer/account/loginPost/" method="post">
<input name="form_key" value="<?php echo $key; ?>" type="hidden">
<input type="text" name="login[username]" value="username" />
<input type="password" name="login[password]" value="password" />
<input type="submit" name="submit" value="submit" />
</form>
Edit
My Problem is $this->getBlockHtml('formkey');
and Mage::getSingleton('core/session')->getFormKey()
not same is there any way to use real form key.
$coreSession = Mage::getSingleton('core/session', array('name' => 'frontend'))->start();
instead of$coreSession = Mage::getSingleton('core/session', array('name' => 'frontend'));
.