using the google sheets api

别来无恙 提交于 2019-12-24 05:21:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!