0

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.

Fred Finkle
  • 115
  • 1
  • 1
  • 6
  • Google APIs let you pass in credentials. Just do that. [Check this out](https://developers.google.com/calendar/quickstart/python) - if you have multiple accounts with different credentials, then you'll want to build up a data structure that contains the necessary login information for each account. This would probably be a dict with string keys and values containing other dicts as values that contain the credentials. The string keys would be how you'd look up each user's creds. – CryptoFool Dec 04 '20 at 15:22

1 Answers1

0

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

iansedano
  • 6,169
  • 2
  • 12
  • 24