Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can this be adapted to support multiple users in one run? #199

Open
rooday-doordash opened this issue Oct 17, 2024 · 2 comments
Open

Can this be adapted to support multiple users in one run? #199

rooday-doordash opened this issue Oct 17, 2024 · 2 comments

Comments

@rooday-doordash
Copy link

Basically could I create a single GCP project for my org's CalendarSync, and then reuse that client ID and client secret across many sync.yaml files (I'm imagining each user in my org would configure their file and add it to a repo), and then run calendar sync for those files? Would there need to be any change to CalendarSync, or if in it's current state could it do this?

- CalendarSync/
    - calendarsync
    - auth-storage.yaml
    - user1-sync.yaml
    - user2-sync.yaml
    ...

Then have some script that on a schedule does:

userConfigs = all *-sync.yaml files
for userConfig in userConfigs
    CALENDARSYNC_ENCRYPTION_KEY=sharedkey ./calendarsync --config userConfig
@rooday-doordash
Copy link
Author

Actually the immediate issue I see with this is that when you run it, it brings you to project consent page, which users won't see if this runs on a service account. Is there any way this could be configured such that if we used a service account credentials that had access to the org's calendars, it could handle syncing for them without needing to show the consent screen?

@MichaelEischer
Copy link
Collaborator

Is there any way this could be configured such that if we used a service account credentials that had access to the org's calendars, it could handle syncing for them without needing to show the consent screen?

calendarsync just issues a regular oauth authentication reqest, see

c.oAuthUrl = c.oAuthHandler.Configuration().AuthCodeURL("state", oauth2.AccessTypeOffline)
. The consent page itself is controlled by GCP. If you have credentials that don't require such a consent then yes, otherwise no. (Don't know if GCP offers that option)

If you use the same service account for everything, then you can probably also share the auth-storage file between invocations. Just be careful to not sync the wrong calendars then. That way you'd only have to authenticate the service account once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants