java - Google Drive revokes my token -


i new google drive , started tutorial quickstart. after numerous attampts run program successfully. had permission , authorisation problems when trying delete files.

drive service = getdriveservice(); service.files().delete("fileid").execute(); 

so decide change url in client_secret.json,

from: "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs"

to: "auth_provider_x509_cert_url":"https://www.googleapis.com/auth/drive"

in hope permission delete files. after executing program again didn't authorization tab of internet browser before.

as example of mentioned tab, here image google playground:

asking permissions in browser

that's reason why delted connection app google drive website:

enter image description here

in addition recreated client_secret.json file. when execute program error, independent doing.

    exception in thread "main" com.google.api.client.auth.oauth2.tokenresponseexception: 400 bad request {   "error" : "invalid_grant",   "error_description" : "token has been revoked." }     @ com.google.api.client.auth.oauth2.tokenresponseexception.from(tokenresponseexception.java:105)     @ com.google.api.client.auth.oauth2.tokenrequest.executeunparsed(tokenrequest.java:287)     @ com.google.api.client.auth.oauth2.tokenrequest.execute(tokenrequest.java:307)     @ com.google.api.client.auth.oauth2.credential.executerefreshtoken(credential.java:570)     @ com.google.api.client.auth.oauth2.credential.refreshtoken(credential.java:489)     @ com.google.api.client.auth.oauth2.credential.intercept(credential.java:217)     @ com.google.api.client.http.httprequest.execute(httprequest.java:859)     @ com.google.api.client.googleapis.services.abstractgoogleclientrequest.executeunparsed(abstractgoogleclientrequest.java:419)     @ com.google.api.client.googleapis.services.abstractgoogleclientrequest.executeunparsed(abstractgoogleclientrequest.java:352)     @ com.google.api.client.googleapis.services.abstractgoogleclientrequest.execute(abstractgoogleclientrequest.java:469)     @ main.java.drivequickstart.main(drivequickstart.java:101)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ com.intellij.rt.execution.application.appmain.main(appmain.java:140) 

so 2 questions should tutorial running again , how set permissions can delete files?

now find out problem: had delete directory "user.home/.credentials/drive-api-quickstart". after can give program authorisation, needs. hope post ;)


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -