问题
I see that the file created with Realtime playground at my Google drive supports Open With
functionality. Despite preview is not available, I can click it and playground app reopens. How do I do the same with my app. I have created a demo one, to add/remove list items and it creates the files in my google drive, similarly to the google realtime playground functionality. The open with
is also available.
Google app files with my app it created. But, clicking it, results in
Sorry, we were unable to authorize this app for all of the files you attempted to open. Please try again.
Is it because I basically have a bad karma or there is objective reason that I miss?
The first answer suggests that I have to do Google Drive API Drive UI integration
. The doc says particularly, that open-with
is provided by Open URL piece. With a great effort, I have added the verified Open URL in the integration settings, but this has no effect. I am still getting the same Unable to authorize this app error
.
回答1:
Make sure that you have enabled the Drive SDK service.
The error Sorry, we were unable to authorize this app for all of the files you attempted to open. Please try again.
means that you need to authorize the user. Google APIs use the OAuth 2.0 protocol for authentication and authorization. Google supports common OAuth 2.0 scenarios such as those for web server, installed, and client-side applications.
All applications follow a basic pattern when accessing a Google API using OAuth 2.0. At a high level, you follow four steps:
- Obtain OAuth 2.0 credentials from the Google API Console.
- Obtain an access token from the Google Authorization Server.
- Send the access token to an API.
- Refresh the access token, if necessary.
Note: Save refresh tokens in secure long-term storage and continue to use them as long as they remain valid. Limits apply to the number of refresh tokens that are issued per client-user combination, and per user across all clients, and these limits are different. If your application requests enough refresh tokens to go over one of the limits, older refresh tokens stop working.
来源:https://stackoverflow.com/questions/38423649/preview-and-open-with