I have created customer using following links:

The customer is created and I can see it in the customers list using admin account.

But I am unable to login into the storefront using the provided credentials which I used during programatically creation process. When I try to login, I get following error:

The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.

I have a clue when I checked the database, but I could not find the actual issue. The clue is for the customer entry in customer_entity table:

  1. store_id & website_id is 0 while normal customers have non-zero value.
  2. created_in column value is "Admin" while customer has value "Default store view".
  3. rp_token and rp_token columns contains NULL value while normal customer have some values.

I am unable to trace the exact issue. And suggest what should be the solution..

Thanks in advance!

2 Answers 2


I think the problem is the store_id, website_id being zero.
At least in Magento 1, a customer associated to the admin website could not login in the frontend. It was there just for creating orders associated to him/her in the backend.
I wrote a few more words about it (but for magento 1) in here: Customer Associated with the Admin Store

But you can simply test if this is the case by changing the values of store_id and website_id to some valid values.
Bonus: rp_token is used for requesting a new password using the "Forgot my password" link. so it's normal to be null for newly created customers.

  • The problem was with store_id and website_id exactly. I retrieved the store_id of default store then website_id from it. It is working fine now. Thanks! Commented Feb 28, 2020 at 15:59

You should not use object manager. You can now use the account management api to create customers very easily.

Try this way:

 * @category    Magento 2
 * @author      Mattia Kozianowski

namespace Vendor\Module;

use Magento\Customer\Api\Data\CustomerInterface;

 * Class CreateCustomer
 * @package Vendor\Module\Controller\Account
class CreateCustomer
     * @var \Magento\Customer\Api\Data\CustomerInterfaceFactory
    protected $customer;

     * @var \Magento\Customer\Api\AccountManagementInterface
    protected $accountManagement;

     * CreateCustomer constructor.
     * @param \Magento\Customer\Api\AccountManagementInterface $accountManagement
     * @param \Magento\Customer\Api\Data\CustomerInterfaceFactory $customer
    public function __construct(
        \Magento\Customer\Api\AccountManagementInterface $accountManagement,
        \Magento\Customer\Api\Data\CustomerInterfaceFactory $customer
    ) {
        $this->customer = $customer;
        $this->accountManagement = $accountManagement;

     * @return \Magento\Customer\Api\Data\CustomerInterface
     * @throws \Magento\Framework\Exception\LocalizedException
    public function createCustomer(): CustomerInterface
        /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */
        $customer = $this->customer->create();
            ->setEmail('[email protected]')
            /*SET ALL YOUR DATA HERE*/
        $password = 'password123';
        return $this->accountManagement->createAccount($customer, $password);
  • This seems a great approach. Commented Feb 21, 2020 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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