I created a google project, and setup all I need to use google drive API with JWT crementials.
It doesn't need any auth2 authentification since it's a server-server communication, user are not involved in the process.
This is working fine but why it's not using my account drive? If I create a folder or a file, I can"t see it in google drive, so is this using a different storage, and if so, do I have a way to see all my files and folder like a normal google drive account?
I'm using nodeJs and so far this worked :
var google = require('googleapis');
var drive = google.drive('v3');
var config = require('../config/config');
var jwtClient = new google.auth.JWT(config.google.drive.client_email, null, config.google.drive.private_key, ['https://www.googleapis.com/auth/drive'], null);
jwtClient.authorize(function(err, tokens) {
if (err) {
console.log(err);
return;
}
// Make an authorized request to list Drive files.
//drive.files.create({
// auth: jwtClient,
// resource: {
// mimeType: 'application/vnd.google-apps.folder',
// title: 'my new folder'
// }
//},function(err,response){
// if(err){
// console.log('error at gdrive creat folder: ' + err);
// }else{
// console.log('create response: ');
// }
//});
drive.files.list({ auth: jwtClient }, function(err, resp) {
// handle err and response
console.log('err', err);
console.log('resp', resp);
});
});