       ]
     .spread (user, match) ->
       if match
-        return _jwtPayloadPromise user
+        return _hninvoke(api.AuthImpl, 'jwtPayload', user)
 
       throw new UnauthorizedError(
         'Invalid credentials', 'invalid_credentials')


    deferred.promise.nodeify callback

  _findUserPromise = (login) ->
    if Q.isPromiseAlike api.AuthImpl.findUser
      api.AuthImpl.findUser login
    else
      Q.ninvoke api.AuthImpl, 'findUser', login

  _jwtPayloadPromise = (user) ->
    if Q.isPromiseAlike api.AuthImpl.jwtPayload
      api.AuthImpl.jwtPayload user
    else
      Q.ninvoke api.AuthImpl, 'jwtPayload', user

  signIn = (login, password, callback) ->
    deferred = Q.defer()
    unless api.AuthImpl and api.AuthImpl.findUser and api.AuthImpl.jwtPayload

        new ImplementationError("no 'api.AuthImpl.findUser' and or
          'api.AuthImpl.jwtPayload' implementation.", 'signin_impl_error'))

    _hninvoke(api.AuthImpl, 'findUser', login)
    .then (user) ->
      Q.all [
        Q(user)
