OAuth 2 Authentication?

149 views
Skip to first unread message

finc...@gmail.com

unread,
Mar 3, 2013, 6:17:15 PM3/3/13
to excel-r...@googlegroups.com
First of all, just want to thank you for all of the information you've made available to everyone. Going through the code in your cDataSet project has been... enlightening. So, again, thanks. But of course I have a question!

So I'm attempting to access a private/protected google docs worksheet from VBA. Use it something like a database etc. I've looked into the Google API for all of this, but I'm still pretty new to programming and there's something I'm clearly not getting. I'm using this documentation as a frame of reference:


Basically I need some guidance on how to plug in all of this information into your cbrowser/googleWireExample work. I've created and setup the API access through Google (Excel would be considered an "installed application", right?) I've been messing around with it for a few days now and I just can't get it sorted out. When I set a practice workbook to public, I can get the information no problem. So I'm not completely lost, hopefully! 

Basically, as I understand it, I need to:

1. Send a query (with specific parameters from the API console. Client ID, Client Secret, Redirect URI?) to Google.
2. Get an access code/token as response
3. Somehow use the taken info + the desired data location to harvest the data I need

Should I be using the "sWire = cb.httpGET(url)" the googleWireExample module to feed in the additional arguments? And what should I even have that initial URL pointing to? The workbook I want to get data from or something like "https://spreadsheets.google.com/feeds" ? 

I assume that the "oHttp.SetRequestHeader" parameters in the httpGET function also play a role in this whole process, but everything I've messed around with hasn't gotten me any closer. I just get a response about not being logged in etc. I don't know if I'm most of the way there or completely off the grid, and it's a little frustrating. 

Thank you in advance for any help you can provide. And thanks again for providing such valuable resources for everybody to use. Let me know if I can offer any further details to help solve the problem. 



Bruce McPherson

unread,
Mar 4, 2013, 2:47:11 AM3/4/13
to excel-r...@googlegroups.com
Very good question. Oauth2 from excel is on my list, bit I haven't quite got to it yet.

One of the things that's held me back is that I don't want to store any credentials in excel. Here's how I tackle oauth2 from google apps script...http://excelramblings.blogspot.co.uk/2012/09/using-google-apps-scriptdb-as-lockbox.html

More importantly though, I'm currently playing around with further abstraction for cdataset (btw there is a gas version also http://ramblings.mcpher.com/Home/excelquirks/gooscript/cdataset ) so that the source can be google docs and various other sources, transparently.. Meaning that you can do cdataset things without the need for an underlying excel sheet, and you can use it to update the source, whatever it is, just like you can in excel.  Right now the google docs import is kind of a hack.

Anyway, to do this I need to solve this authentication issue, amongst other things, .. It's not an easy answer directly from excel .. But I will be doing that as part of the cdataset abstraction update..in would say that's at least a couple of months off .. However the end result is that your excel code will be source and target independent 

Bruce

Sent from my iPad
--
You received this message because you are subscribed to the Google Groups "Excel Liberation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to excel-ramblin...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

finc...@gmail.com

unread,
Mar 5, 2013, 12:32:24 PM3/5/13
to excel-r...@googlegroups.com
I was afraid you'd say that! Thanks for a point in the right direction at the very least. I'm not worried about storing credentials in the macro (at least the API access stuff) so hopefully I can MacGuyver something together with the resources you've provided sometime before you get around to showing me what's what when you have time. Thanks again for your help!
Reply all
Reply to author
Forward
0 new messages