Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unauthenticated issue #4

Open
SantoshKumarRavi opened this issue Oct 30, 2023 · 0 comments
Open

Unauthenticated issue #4

SantoshKumarRavi opened this issue Oct 30, 2023 · 0 comments

Comments

@SantoshKumarRavi
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant