Konrad Podgórski - Web Developer

Personal blog about developing web applications with PHP

[How to] No encoder has been configured for account

Please keep in mind that this post was written more than 2 years ago and might be outdated.

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

    # 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 a wrong order. Make sure that SecurityBundle is loaded before FOSUserBundle

AppKernel

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

on

Find this post helpful? Spread the word, thanks.

Comments