After creating a service account from the google iam console, and having obtained the json with the private_key,client_email and so on... I have problems integrating them into my javascript code to upload a file to google drive with an authentication server to server. With the use of nodejs I didn't have any problem (I used JWTtoken), I would be grateful if you could help me to insert the authentication parameters correctly in the javascript post request code of the example.
$.ajax({
type: "POST",
url: "https://www.googleapis.com/upload/drive/v3/files",
data:{
uploadType:"multipart",
parents: ["xxxxxxxxxxxxxxxxxxxxxxxx"]
},
success: function (data) {
console.log(data);
},
error: function (error) {
console.log(error);
},
async: true,
data: formData,
cache: false,
contentType: false,
Authorization: ????????????????? <---
processData: false,
timeout: 60000
});
};
When I try to do to update this file I see no result. Can someone help me?
from Google drive api rest upload file with service account not works
No comments:
Post a Comment