Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Trouble while authenticating using json key file

Hey everyone! I’m facing an issue trying to authenticate using json key file where my GoogleCredentials work perfectly fine on my local machine but don’t on the server. I’m using the following code:

 

InputStream credentialsStream = createJsonFile(keyFileStream); //reading json key file
GoogleCredentials credentials = GoogleCredentials.fromStream(credentialsStream)
.createScoped(
Collections.singletonList("https://www.googleapis.com/auth/devstorage.full_control")
); //on this step program stuck without any error

Problem:

  • It works locally, but on the server, not working and I'm not getting any error it stuck on this step.

Anyone else faced this issue or have any solutions?

This issue has become critical for me, so I am reaching out to you for help or suggestions.

 @SEVERO  @yashgoyal365 @Abhishek213 @AlexET @harishgoogler 

0 1 213
1 REPLY 1

Hi @devmanish,

Welcome to Google Cloud Community!

If your codes doesn’t work you may refer to these documents for guidance when working with your JSON file:

If the issue persists, don't hesitate to reach out to Google Cloud Support by filing a ticket for further assistance.

I hope the information above is helpful.