Google API - Authentication - Worst Possible thing ever!

It feels like I’ve been to the moon and back since the last time I’ve attended to the SitePoint community… I’ve been a member here since as early as 2002… but I come begging for direction. I have this community to thank for at least a 3rd of the length of my career, and the fact that I’ve finally decided to stop being a typical guy and ask for some direction, means a bunch. I haven’t asked a question in at least 8 years… Until now, Google has provided the answers, but not today!

I’ve gone through setting up all my scopes, my service account, and API keys… it took me two days to get working properly, and when I did, I thought I had it waxed, until today. I’ve enabled two API’s on my Google Apps Admin Console… Admin SDK, and Gmail API. I am using the main Admin account for my domain, on a Google Apps infrastructure that’s been carrying a company with for the last three to four years. I am now attempting the “simple” task of tapping into directory user’s email headers, and it’s a nightmare.

My Admin SDK API access works fine… Permissions are set… I’m using the Google API PHP library, which I’ve installed through composer on a Laravel app that I’ve been building and maintaining for the past year and a half. I use the exact same PHP Library, access and service account on the Directory Admin SDK API, enabled on the exact same Project within my developers console, and configured all the scopes that are required for my requests, and I constantly receive “Delegation denied for …@…com”. Yet, I am able to get all users on the domain through the Admin SDK API.

I am fed up, and I feel like it’s time to retire.

Please can I hit somebody at Google, or could the Sitepoint community help avoid blood spillage?

1 Like

Okay, so I figured this out… If anyone ever gets stuck with something similar to this issue, specifically when receiving a message of “Delegation denied for user@domain.com”, don\t be like me and try to get violent with Google.

Instead, be like the other side of me, go to bed, get a good night’s sleep, and then, use “me” in your user_id field for your requests, and call the setSubject method on the google api client object, passing it a proper user id, and your results should follow. So woop! :slight_smile:

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.