Google Drive AppData Not Permitting Insert -


using google drive api v2 rev 75 attempting insert file appdata folder, insertion fails with:

com.google.api.client.googleapis.json.googlejsonresponseexception: 403

"the current scope not allow use of appdata folder"

the scope "https://www.googleapis.com/auth/drive.appdata" specified in api console though, i'm little stuck.

the insertion code goes:

    file file = new file();     file.settitle("myfile");     file.setdescription("configuration file");     file.setmimetype("text/plain");     file.setparents(arrays.aslist(new parentreference().setid("appdata")));      try {         file file1 = service.files().insert(file, bytearraycontent.fromstring("text/plain", "some settings")).execute();     } catch (ioexception e) {         log.severe("an error occured: " + e);         return null;     } 

the authorisation code use follows detailed in dredit [sample]( https://code.google.com/p/google-drive-sdk-samples/source/browse/java/src/com/google/drive/samples/dredit/credentialmediator.java?r=54312a4a583d5a2ba546330a892c4b0aca75c00d)

specific snippets of code include:

public static final list<string> scopes = arrays.aslist(         // required access , manipulate files.         "https://www.googleapis.com/auth/drive.file",         ...         "https://www.googleapis.com/auth/drive.appdata"); 

...

credentialmediator mediator = new credentialmediator(req, authsecrets.getclientsecretsstream(), scopes); 

...

googleauthorizationcoderequesturl urlbuilder = new googleauthorizationcoderequesturl(         secrets.getweb().getclientid(),         secrets.getweb().getredirecturis().get(0),         scopes)         .setaccesstype("offline")         .setapprovalprompt("force"); 

any ideas why getting problem? thanks.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -