Skip to content

Unauthenticated issue #4

@SantoshKumarRavi

Description

@SantoshKumarRavi

i have used correct private key of my buyer app,
i am getting Unauthenticated err.
i am new to ondc network.

and this is my code

  const instance = new ondc.ONDC({
    host: "https://ref-app-buyer-staging-v2.ondc.org/clientApis/v1",
    bapId: "xxx.com",
    bapUri: "https://xxx",
    country: "IND",
    city: "*",
    ttl: "P1M",
    uniqueKey: xxx,
    domain: "nic2004:52110",
    subscriberId: "xx.com",
    signingPublicKey: "xxxxxx",
    encryptionPublicKey:
      "xxxxxxxxxx",
    privateKey:
      "xxxxxxxxxxxxx",
  });
  let body = {
    item: {
      descriptor: {
        name: "ABC Aata",
      },
    },
    fulfillment: {
      end: {
        location: {
          gps: "12.4535445,77.9283792",
        },
      },
    },
  };
  // apiKey is sent in Authorization Header
  const headerStr = await instance.createAuthorizationHeader(body);
  instance.apiKey=headerStr
  const response = await instance.search(body);
  console.log("response", response);
  res.status(200).send(response);

Can u help me to overcome this issue ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions