What I want to achieved:
Get the access token to access the Google Drive API from an AppEngine application, from the user Android smartphone.
I have an Android application and a GAE server with endpoints. Is there another way than creating a webview directing to a GAE handler ( https://developers.google.com/drive/examples/python#authorization )?
I would like to use play service since it should be more convenient, but then i am stuck with the android client_secret and so on.
Thanks
I tried what was suggested below, but I got this exception
06-14 18:07:33.032: W/System.err(12378): com.google.android.gms.auth.GoogleAuthException: Unknown
06-14 18:07:33.052: W/System.err(12378): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
06-14 18:07:33.052: W/System.err(12378): at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
06-14 18:07:33.052: W/System.err(12378): at edu.kaist.wst660.bmaingret.android.MainActivity.getAndUseAuthTokenBlocking(MainActivity.java:361)
06-14 18:07:33.057: W/System.err(12378): at edu.kaist.wst660.bmaingret.android.MainActivity$10.doInBackground(MainActivity.java:405)
06-14 18:07:33.057: W/System.err(12378): at edu.kaist.wst660.bmaingret.android.MainActivity$10.doInBackground(MainActivity.java:1)
06-14 18:07:33.062: W/System.err(12378): at android.os.AsyncTask$2.call(AsyncTask.java:264)
06-14 18:07:33.062: W/System.err(12378): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-14 18:07:33.062: W/System.err(12378): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-14 18:07:33.062: W/System.err(12378): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
06-14 18:07:33.067: W/System.err(12378): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
06-14 18:07:33.072: W/System.err(12378): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
06-14 18:07:33.072: W/System.err(12378): at java.lang.Thread.run(Thread.java:856)
I have seen more verbose exceptions...
Note: I follow this link http://developer.android.com/reference/com/google/android/gms/auth/GoogleAuthUtil.html with this scope oauth2:server:client_id:xxxxxxxx.apps.googleusercontent.com:api_scope: https://www.googleapis.com/auth/drive.file
建议阅读以下文档,我认为该文档可以解决您描述的情况: https : //developers.google.com/accounts/docs/CrossClientAuth
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.