DataFlow :missing required authentication credential

Viewed 731

I am getting following error while running DataFlow pipeline

Error reporting inventory checksum: code: "Unauthenticated", message: "Request is missing required authentication credential. 
Expected OAuth 2 access token, login cookie or other valid authentication credential.

We have created service account dataflow@12345678.iam.gserviceaccount.com with following roles

BigQuery Data Editor
Cloud KMS CryptoKey Decrypter
Dataflow Worker
Logs Writer
Monitoring Metric Writer
Pub/Sub Subscriber
Pub/Sub Viewer
Storage Object Creator

And in our python code we are using import google.auth

Any idea what am I missing here ?

I do not believe I need to create key for SA , however I am not sure if "OAuth 2 access token" for SA need to be created ? If yes how ?

2 Answers

If you are trying to access a service through HTTP, with a custom request (not using a client library), you can obtain a OAuth2 token for that service account using the metadata server of the worker VM. See this example for Cloud Run, you can use the same code snippet in Dataflow to get a token and use it with your custom HTTP request: https://cloud.google.com/run/docs/authenticating/service-to-service#acquire-token

Related