Etting error - **connect ECONNREFUSED ::1:80** or Request failed with status code 404

Getting error - connect ECONNREFUSED ::1:80 while for user verification using @keycloak/keycloak-admin-client version 18.0.0

I’m not able to get what is causing this error. Is my baseURL wrong or what?

when I use details I’m getting this error: Request failed with status code 404 and when I use base URL

P.S: url have been changed, it is not the original server url

import { Injectable, Logger } from '@nestjs/common';
import KeycloakAdminClient from '@keycloak/keycloak-admin-client';

export class ConsoleService {
  private readonly logger = new Logger(;

  async authorizeUser(): Promise<any> {
    try {
      this.logger.log(` Authorize user started`);

      const client = new KeycloakAdminClient( {
        baseUrl: '',
        realmName: 'login-service'
      await client.auth({
        username: '',  // tried master realm username as well
        password: 'test', // tried master realm password as well
        grantType: 'password',
        clientId: 'test' ,  // used admin-cli from master realm as well
       clientSecret: process.env.SECRET  // used credential for admin-cli as well

      this.logger.log(` Authorize user ended`);
    } catch(error) {
      console.log(" error ::: ",error.message)
      this.logger.log(` Authorize user error: ${error.message}`);