# Unable to resolve service error

**URL:** <https://discourse.laminas.dev/t/unable-to-resolve-service-error/2986>\
**Category:** Components & MVC\
**Tags:** laminas-mvc, laminas-di, laminas-authentication\
**Created:** [August 4, 2022, 3:18am UTC](https://discourse.laminas.dev/t/unable-to-resolve-service-error/2986 "2022-08-04T03:18:11Z")\
**Posts on this page:** 1\
**Showing post:** 14

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [August 4, 2022, 7:39am UTC](https://discourse.laminas.dev/t/unable-to-resolve-service-error/2986/14 "2022-08-04T07:39:06Z")

</div>

Here is an example for the factory:

```php
namespace User\Authentication;

use Laminas\Authentication\Adapter\DbTable\CallbackCheckAdapter;
use Laminas\Authentication\AuthenticationService;
use Laminas\Db\Adapter\Adapter;
use Laminas\Db\Adapter\AdapterInterface;
use Psr\Container\ContainerInterface;
use Webmozart\Assert\Assert;

final class AuthenticationServiceFactory
{
    public function __invoke(
        ContainerInterface $container
    ): AuthenticationService {
        $databaseAdapter = $container->get(AdapterInterface::class);
        Assert::isInstanceOf($databaseAdapter, Adapter::class);

        $credentialValidationCallback =
            static function (
                string $dbCredential,
                string $requestCredential
            ): bool {
                return password_verify($requestCredential, $dbCredential);
            };

        $authAdapter = new CallbackCheckAdapter(
            $databaseAdapter,
            'user', // table name
            'email', // identity column
            'password', // credential column
            $credentialValidationCallback
        );

        return new AuthenticationService(null, $authAdapter);
    }
}

```

---

_[View the full topic](https://discourse.laminas.dev/t/unable-to-resolve-service-error/2986)._
