Closed Schepp closed 10 years ago
I've created a new project to help get started with OAuth.
the php-google-oauth is for web authentication involving third-party user interaction. How to handle this with service accounts? My spreadsheets won't show up.
I have been struggling with this for a few hours.
You should mimic your own Google Apps account and setup your credentials like this:
$cred = new Google_Auth_AssertionCredentials(
GOOGLE_CLIENTEMAIL,
array('https://spreadsheets.google.com/feeds'),
file_get_contents(GOOGLE_CLIENTKEYPATH),
'notasecret',
'http://oauth.net/grant_type/jwt/1.0/bearer',
'user@example.org'
);
Follow this to set the right permissions for your account: https://developers.google.com/drive/web/delegation
This is only for google enterprise accounts. Free google accounts don't have their own apps domain and therefore can't delegate domain-wide authority to a service account. Not an option for me.
I know this is a bit old but might help someone who faces the same issue. You just need to share the spreadsheet to your service account email so it will be able to lists it. Thanks
Hey Asim, thank you for putting that much effort into this thing!
Still, I've got to report a problem. I think I got everything set up correctly, but when I want to retrieve the list of spreadsheets located under my account all I get is an empty list. On the other hand, when I'm logged into Google and open https://spreadsheets.google.com/feeds/spreadsheets/private/full in the browser I do see an extensive list of documents. Any idea why that is? I published the spreadsheet and I also set it to publicly visible, but no luck...
Here is my code:
Thank you in advance for your help!