Vonage/vonage-node-sdk

How Do I: get a private_key in the Create Application v2 API in nodejs SDK?

s-lukashenka-micoworks opened this issue · 6 comments

How do I

If I am getting it right, a call to Create Account v2 API is supposed to return a private key alongside the public one, but in nodejs SDK it returns only the public one. Please, make it return the private key as well as that is important for application creation automation.

API/Product

Applications

Code Sample

API documentation pointing to its existence in the API response: https://developer.vonage.com/en/api/application.v2#createApplication-responses

@s-lukashenka-micoworks The keys should be in the response after you call createApplication. The only thing the SDK is doing, is adding the camelCasing properties to the response. This means that you should have the private key under the keys response:

const newApplication = await vonage.applications.createApplication({
  name: 'my-awesome-app',
})

console.log(newApplication.keys.privateKey)
console.log(newApplication.keys.private_key);

LMK if you need any more assistance with this

@manchuck I understand that the actual API returns that parameter, but the types in SDK do not have it: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/lib/types/Application.ts#L29.
Could it be added, please? I can make a PR for that if needed.

@manchuck I have tried making a PR for the changes needed: #956

Ahh, I can see the issue if you're using TypeScript.

@s-lukashenka-micoworks are you still experiencing this issue?

Haven't heard back from @s-lukashenka-micoworks , If you are still having an issue, please re-open this issue