How to add key in open api client?

My question is related to node red openapi client i have used "npm install openapi-red" to install openapi red.
I am using openapi client to show my result but it shows an error of

 {
   "error_message" : "You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account",
   "results" : [],
   "status" : "REQUEST_DENIED"
} 

so i add key value on function node using

msg.openapiToken=" hdgfuiehedjwenishuiew"

(it's just an example) but it still shows the same error as i mentioned above so i
tried

msg.headers = { "key" :"key_value"}

but still shows the same error . So please tell me what should i do to solve this error or what i have to use to resolve this error.

Do you have a valid API key from Google?

Create API keys

The API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes. You must have at least one API key associated with your project.

Yes I have

I edited your first post so it would be easier to read, Hopefully someone with knowledge of the Google API will chime in (I don't use Google)

The documentation of the node describes:

  1. Authentification

If the API requires an authentification token you can log in using the standard http-requestnode of Node-RED. The JWT token you get as a response must then be put into msg.openApiToken to be automatically placed in the request-header as bearer authentification. In case you would like to use a different authentification than bearer, you can use msg.headers as you can do with the default http request node of Node-RED.
Both message object will be deleted afterwards if you do not set the option "Keep authentification".

In short:

  • first post a request with your key to the API.
  • the response will be a JWT token.
  • the JWT token needs to be provided to the open-api node as msg.openApiToken

I am actually doing this but I am not getting the result as I am excepting And now I am not able to do this

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.