[How to] No encoder has been configured for account

I presume you’re using FOSUserBundle with Symfony2, make sure you added to app/config/security.yml these lines

# app/config/security.yml
security:
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

It should look like this:

# app/config/security.yml
security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        FOS\UserBundle\Model\UserInterface: sha512

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

Other possibility might be that you’re loading bundles in wrong order, make sure that SecurityBundle is loaded before FOSUserBundle

AppKernel

new Symfony\Bundle\SecurityBundle\SecurityBundle,
...,
new FOS\UserBundle\FOSUserBundle(),

10 thoughts on “[How to] No encoder has been configured for account

  1. Thanks a lot. This helped me.

    I’m 100% certain this used to work before. But it’s an old project of mine, so maybe the default setting has been removed since? Or do you know what’s caused this?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>