问题
I want to be able to edit a google spreadsheet from a Android app.
I read that I need to do the OAuth 2.0 and only after that I can access the API.
in the Authorizing with Google for REST APIs in the android werbsite, it says:
Note: An OAuth 2.0 token using GoogleAuthUtil is required only for certain types of Google APIs that
you need to access over HTTP. If you're instead using the Google Play services library to access
Google APIs such as Google+ or Play Games, you don't need an OAuth 2.0 token and you can instead
access these services using the GoogleApiClient. For more information, read Accessing Google Play
Services APIs.
My question is: What should I use for the Sheets API?
the Google Play services library and GoogleApiClient?
or the GoogleAuthUtil and the example on the page?
Its really not clear to me what is the correct way to do the OAuth 2.0 for the sheets API.
thnaks!
回答1:
OAuth2 and Google-spreadsheet-API
These are independent -- You get the OAuth2 access & re-fresh tokens and then use the access token with the google-spreadsheet-api.
Understanding OAuth Tokens
For a basic understanding of the tokens see this blog and the references to "Google OAuth2.0 Playground." http://masashi-k.blogspot.jp/2013/06/sending-mail-with-gmail-using-xoauth2.html
OAuth2 & Java
I have not tried this, but looks like the best tutorial I have seen. http://soatutorials.blogspot.co.at/2013/08/google-spreadsheet-api-connecting-with.html From: OAuth2 authorization from Java/Scala using google gdata client API
OR the google DrEdit tutorial includes OAuth2
来源:https://stackoverflow.com/questions/27857866/using-the-google-sheets-api