简体   繁体   中英

authenticate to Google Cloud Platform from a Linux Server

I have developed a java program that involves API connections, DataFlow pipelines and BigQuery to load data.

Locally in my computer it works fine with GCP authenticator and running pipelines in the cloud.

But when I run a class in the linux server it ask me for authentication but with an url.

this is the output in the server

I tried "gcloud init" sending credentials but it still asking me for authentication.

has anyone faced this situation?

thanks!

Your application is attempting to use OAuth 2.0 Flow to obtain credentials. Since your server does not have a web browser, you are given a URL to go to in your browser. Once you do that you will receive a code to copy-and-paste back into your server.

The solution is to change your program to use Google Service Account Credentials.

This link has a detailed explanation and code examples including Java.

Setting Up Authentication for Server to Server Production Applications

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM