3

I'm trying to set up the UserBundle from FOS for symfony 2. When creating a new User, it get an exception that no encoder has been configured.

If I do set up the encoder like this:

fos_user:
    db_driver: orm
    provider_key: fos_userbundle
    class:
        model:
            user: Crm\MyBundle\Entity\User
            group: FOS\UserBundle\Entity\DefaultGroup
    encoder:
        encode_as_base64: ~
        algorithm: ~
        iterations: ~

I get a new Exception: InvalidArgumentException.

If I remove iterations and algorithm, the new exception goes away, but then the old "no encoder configured" comes back.

To me it seems as the EncoderFactory in FOS\UserBundle\Security is never used, and the factory from symfony is used instead. I am not sure what to do with this, because frankly I don't know what this "encoder factory" does.

None could help on #symfony (IRC), and I found one other guy having the exact same problem: http://groups.google.com/group/symfony-users/browse_thread/thread/1e0f5797d9357295/d6cd0f7dfc721cbd?show_docid=d6cd0f7dfc721cbd

Thanks

  • this helped me http://konradpodgorski.com/blog/155/how-to-no-encoder-has-been-configured-for-account/ –  Dec 27 '11 at 18:10

1 Answers1

5

So the problem was that I loaded my bundles in the wrong order... :)

If anyone else get this problem, make sure that this is the order in registerBundles() in AppKernel

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