在 Bot Framework 中使用 Google 日历 API - 每次都授权?
Using Google Calendar API in Bot Framework - Authorize every time?
我想让我的机器人(C# 中的 Microsoft Bot Framework)访问我的 google 日历,以便我和与机器人聊天的其他人可以查看即将发生的事件。我发现的大多数 Google 文档都展示了如何授权新用户自己的 Google 日历(https://developers.google.com/google-apps/calendar/quickstart/dotnet 和 OAuth 2.0 库)),但我不希望机器人访问特定的用户的日历,每次只有一个特定的日历。
bot是否需要重复授权才能查看这个日历?我能否在代码中嵌入凭据,这样就不会提示用户进行授权?
谢谢:)
尝试使用 Google Service Accounts。
The Google OAuth 2.0 system supports server-to-server interactions such as those between a web application and a Google service. For this scenario you need a service account, which is an account that belongs to your application instead of to an individual end user. Your application calls Google APIs on behalf of the service account, so users aren't directly involved. This scenario is sometimes called "two-legged OAuth," or "2LO." (The related term "three-legged OAuth" refers to scenarios in which your application calls Google APIs on behalf of end users, and in which user consent is sometimes required.) Typically, an application uses a service account when the application uses Google APIs to work with its own data rather than a user's data.
我想让我的机器人(C# 中的 Microsoft Bot Framework)访问我的 google 日历,以便我和与机器人聊天的其他人可以查看即将发生的事件。我发现的大多数 Google 文档都展示了如何授权新用户自己的 Google 日历(https://developers.google.com/google-apps/calendar/quickstart/dotnet 和 OAuth 2.0 库)),但我不希望机器人访问特定的用户的日历,每次只有一个特定的日历。
bot是否需要重复授权才能查看这个日历?我能否在代码中嵌入凭据,这样就不会提示用户进行授权?
谢谢:)
尝试使用 Google Service Accounts。
The Google OAuth 2.0 system supports server-to-server interactions such as those between a web application and a Google service. For this scenario you need a service account, which is an account that belongs to your application instead of to an individual end user. Your application calls Google APIs on behalf of the service account, so users aren't directly involved. This scenario is sometimes called "two-legged OAuth," or "2LO." (The related term "three-legged OAuth" refers to scenarios in which your application calls Google APIs on behalf of end users, and in which user consent is sometimes required.) Typically, an application uses a service account when the application uses Google APIs to work with its own data rather than a user's data.