So I'm having some trouble adding the service account to my php web app. Little background - it's a little web app that works off my colleagues gmail inboxes and manages and organizes maintenance notifications ( regarding datacenter circuits) from suppliers based on which we need to lookup the affected customers and forward the info on to them so everyone is aware of scheduled down time.
So I have an "incoming maintenance" table which just lists the unread mails in a specific label and allows the user to then save the gmail message ID and a bunch of other info to a sql db.
The problem I've run into is that even among messages sent to every user, gmail assigns different message IDs for everyone's inbox.
So I decided to implement a service account and use that to allow everyone using this app to "work" out of one person's inbox, in the background, therefore keeping the IDs always consistent.
I have the normal oauth2 up and running with the required scope without a problem, but am now having trouble also getting the service account to authenticate.
I have enabled delegation of the service accounts rights within our g suite account.
I keep getting error messages regarding "not allowed to get tokens using that method.." which makes me think the service account and individual user logins are getting crossed up somewhere along the line. I've made sure to use different variables for the service and client objects and everything, however.
I'm in the train now, but I will copy some code examples into here as soon as I get home. But in general, is this even possible? I haven't seen any documentation about it.
I want my users to be able to authenticate themselves with their work G suite accounts to get into the application in general ( and to grab a few other things from their accounts within the app) - but need this service account functionality to manage the email fetching / saving system on the backend.