Warm tip: This article is reproduced from serverfault.com, please click

How to sign-in to a google account inside my app without using a UX (on macos)

发布于 2020-12-04 15:11:43

All the examples of getting access to a google api (in my case, the calendar api) uses the google sign-in api (which produces a UX for selecting the account).

In my case, I have a toy app that wants to use a private calendar as a resource for that app. The resource isn't available to a user of the app (even if I wanted to use the sign-in approach).

I need a way of selecting, internally, a google account with an email_account and password.

I can't seem to find out if this kind of approach is allowed or not and if it's allowed how do I code for that.

Thanks in advance.

Questioner
Fred Finkle
Viewed
11
iansedano 2020-12-07 16:30:05

Service accounts

The only way to do this freely is within an organisation using service accounts. You can't log into a normal consumer (gmail) account in this way. This is as much a security measure as anything.

There is a official Python quickstart available here and you may find it helpful to look over my other answer here.

Server side web apps

This will probably be the best avenue for you to work with if you are not within an organisation. These apps get their credentials from the credentials page in the cloud console. You configure these to get access to your resources. Since it sounds like the users of your app will not be using it to modify any of their own resources, then you won't need to ask for authentication from them.

References