Splitting this off from #46, we could also support per-calendar (or at least per-bot) credentials as well. A new credentials (or accounts, apis, ...) module could offer a menu where users can either set a single Google account (as well as any other API sources—Eventbrite, GitHub, etc., possibly even including the Telegram Bot API token?) or add any number of any type of accounts (though probably the former):
assert conversation.message('/admin modulestestbot credentials') == """\
[chat_id=1000 disable_web_page_preview=True parse_mode=HTML]
Bot Admin › modulestestbot › credentials: <b>Choose a service</b>
I don't have any credentials for external services. Choose a service to configure:
[GitHub | /admin modulestestbot credentials github]
[Google | /admin modulestestbot credentials google]
[Back | /admin modulestestbot]
"""
assert conversation.message('/admin modulestestbot credentials google') == """\
[chat_id=1000 disable_web_page_preview=True parse_mode=HTML]
Bot Admin › modulestestbot › credentials › google: <b>Provide credentials</b>
You can allow modulestestbot to either act on your behalf or on behalf of a Google Cloud Project.
To act on your behalf, click this link to generate an Authentication Token, then paste it back here:
https://accounts.google.com/o/oauth2/auth?scope=...&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&access_type=offline
To act on behalf of a Google Cloud Project, follow the instructions at this link, then send the <code>google_credentials.json</code> file you receive to me:
https://cloud.google.com/iam/docs/creating-managing-service-accounts#creating_a_service_account
[Back | /admin modulestestbot credentials]
"""
assert conversation.message('4/AAAAA-BBBBB') == """\
[chat_id=1000 disable_web_page_preview=True parse_mode=HTML]
Bot Admin › modulestestbot › credentials › google: <b>Provide credentials</b>
modulestestbot can now act on behalf of <code>exampleuser@gmail.com</code>!
You can allow modulestestbot to ...
[Back | /admin modulestestbot credentials]
"""
Then, when the [new] bot-specific calendar driver wants to talk to Google Calendar, it will check that bot's credentials modconf.
Splitting this off from #46, we could also support per-calendar (or at least per-bot) credentials as well. A new
credentials
(oraccounts
,apis
, ...) module could offer a menu where users can either set a single Google account (as well as any other API sources—Eventbrite, GitHub, etc., possibly even including the Telegram Bot API token?) or add any number of any type of accounts (though probably the former):Then, when the [new] bot-specific calendar driver wants to talk to Google Calendar, it will check that bot's
credentials
modconf.