I am building an extension that saves a new event to the default
calendar in the user's Google Calendar account. I am new to OAuth,
and I was happy to learn about the Chrome Extension OAuth libraries.
Unfortunately, the tutorial for these libraries was vague enough to
lead me to believe that using them would be straight-forward. The
reality, as I soon learned, is that the example gDoc extension is only
a useful model in the most general sense. What is atom/xml? What is
GData? What if I plan on accessing an API other than Docs?
I assumed that I could find answers to these questions by doing the
usual battery of searches, link clicking, and and forum querying.
What I mainly learned at first is that GData has been deprecated, as
has Atom/xml. It took me some time to find documentation for the
deprecated Calendar API v2. Its link in the Calendar API navigation
column had been colored such a faint grey that I unconsciously took it
for an inactive link. As it turns out, I found most of my answers
there. I still could not access the Calendar API using this code:
var onAuthorized = function() {
var url = '
https://www.google.com/calendar/feeds/default/private/
full';
var request = {
'method': 'POST',
'headers': {
'GData-Version': '3.0',
'Content-Type': 'application/atom+xml'
},
'parameters': {
'alt': 'json'
},
'body': gCal.constructAtomXml()
};
gCal.oauth.sendSignedRequest(url, handleResponse, request);
};
This gave me a 403 code: "Version 3.0 is not supported." or something
like that. I changed to: 'GData-Version': '2.0', and all was well.
I'll get to the point. I would think that the use of the
chrome_ex_oauth libraries is crucial for many extensions. Why does it
get such limited attention? Are there other ways to access the Google
APIs through an extension? Can they integrate the newest versions of
these APIs, using JSON instead of atom/xml? If not, wouldn't new
developers such as myself benefit from a simple update in the
extensions OAuth tutorial that lets us know that the libraries rely on
deprecated APIs and that the documentation and examples included will
likely prove insufficient or misleading?
This is my first post in this group. Please don't take this as a pure
rant. I really do want to know if I have been looking in the wrong
places, or if others have experienced similar frustration. I want to
learn to write a first-class extension, and I feel that all along the
way the documentation has been helpful but vague in ways that pushed
me into a code-save-reload trial-and-error approach. If anybody has
some insight for me, or if I should take my issues elsewhere, please
let me know.
On the more constructive end: I would love to see some tutorials
dedicated to extensions and Google APIs in the extension docs.