DSS connection to GCS - Unable to read private key
hello,
Wen configuring DSS connection to GCS the json file failed to be read.
When introducing the key file (json file) generated for GCP:
first I received the error message where "type" field is missing, I added mannually "type":service-acount" and now it's complaining with:
Connection failed: Unable to extract private key from supplied JSON string., caused by: IOException: Error reading service account credential from stream, expecting 'client_id', 'client_email', 'private_key' and 'private_key_id'.
the entire field needs rework ? is there a similar situation when generating the json file from GCP?
thanks in advance.
Operating system used: CentOS8
Best Answer
-
yes, the json file was being exported corrupted in my browser.
I took reference of the file structure frol here: https://github.com/googleapis/google-auth-library-java/blob/main/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
String fileType = (String) fileContents.get("type");
if (fileType == null) {
throw new IOException("Error reading credentials from stream, 'type' field not specified.");
}
if (USER_FILE_TYPE.equals(fileType)) {
return UserCredentials.fromJson(fileContents, transportFactory);
}
if (SERVICE_ACCOUNT_FILE_TYPE.equals(fileType)) {
return ServiceAccountCredentials.fromJson(fileContents, transportFactory);
}
if (GDCH_SERVICE_ACCOUNT_FILE_TYPE.equals(fileType)) {
return GdchCredentials.fromJson(fileContents);
}
if (ExternalAccountCredentials.EXTERNAL_ACCOUNT_FILE_TYPE.equals(fileType)) {
return ExternalAccountCredentials.fromJson(fileContents, transportFactory);
}so I recreate the file and maje sure the file was indicating all the fileds. add it again in the system and this time it take it without problem.
Answers
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,181 Neuron
Can you please post the contents of your GCP JSON file? (Replace the secret parts with xxx).
-
Hi! It's already solved, thanks very much
-
Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,181 Neuron
Do you mind please sharing what was the problem and the solution so others can benefit from your post? Thanks