Hi,
I am trying to access DNS API of google project 1 from cloud function Node.js code which is deployed on project 2
For credentials, I am using service account key, The service account holds DNS Admin Role on project 1.
Solved! Go to Solution.
I'll make a guess ...
If we look at the API call you are making which I believe is documented here:
https://cloud.google.com/dns/docs/reference/v1/projects/get
We see under the "Authorization" section a list of "scopes" that the request can be made under. The most common one that I use is "https://www.googleapis.com/auth/cloud-platform". If I am reading your code correctly, in your code you have requested just one scope which is "https://www.googleapis.com/auth/firebase.messaging" and if I am interpreting that correctly, by not including one of the documented required scopes, your request will fail. See what happens if you use one of the documented scopes.
I think I am hearing that you have a NodeJS application that is attempting to make Google Cloud API calls to the DNS API. That application is coded as a Cloud Function and when the function runs, the Cloud Function fails and throws an exception when the DNS API is invoked. What exactly does the invocation / code of the DNS API look like? Which specific API with parameters is being invoked?
Hi ,
Attaching the Screenshot containing the code and DNS API Endpoint
I'll make a guess ...
If we look at the API call you are making which I believe is documented here:
https://cloud.google.com/dns/docs/reference/v1/projects/get
We see under the "Authorization" section a list of "scopes" that the request can be made under. The most common one that I use is "https://www.googleapis.com/auth/cloud-platform". If I am reading your code correctly, in your code you have requested just one scope which is "https://www.googleapis.com/auth/firebase.messaging" and if I am interpreting that correctly, by not including one of the documented required scopes, your request will fail. See what happens if you use one of the documented scopes.
We tested the https://www.googleapis.com/auth/cloud-platform". this scope, getting insufficient permission ERR,
I need to use "https://www.googleapis.com/auth/firebase.messaging" this scope to collect the access token.
Hi,
Changing the scope "https://www.googleapis.com/auth/cloud-platform" works for me.
Thankyou.