嵌入Google日历后,只有登录到我的网站(不一定通过Google)的用户才能看到 [英] Embed Google Calendar only users logged into my website (not necessarily through Google) can see
问题描述
我有一个.NET页面,用户可以通过多种方法登录,包括Google,Facebook,Twitter,以及直接在网站上创建用户名和密码.我有一个页面,只有登录用户才能看到其中嵌入了日历的页面.
I have a .NET page which users can log into through various methods, including Google, Facebook, Twitter, and by creating a username and password directly on the site. I have a page that only logged-in users can see that has a calendar embedded.
目前,此日历尚未公开,并且只有我授权的Google用户才能看到.我当然可以将其公开,但是一旦有人知道日历的网址,他们就可以去那里查看它.我也可以与通过Google注册到我的网站的任何人共享它,但是通过Facebook或其他方式登录的人看不到它.
Right now this calendar is not public, and can only be seen by Google users I authorize. I could of course make it public, but then once anyone knows the url of the calendar alone they could just go there and see it. I could also share it with anyone who's registered to my website through Google, but then it wouldn't be visible to people logged in through Facebook or some other way.
问题:我如何以编程方式接收日历并将其显示给以任何方式登录到我的网站的任何人,而不必将其公开?
Question: How can I programmatically receive the calendar and display it to anyone who's logged into my website any way without having to make it public?
对我来说有意义的两种方法是:
The two approaches that make sense to me are:
- 使用我自己站点的身份验证(可能从服务器端)来 检索日历并以某种方式显示它而不给用户 他们可以将Google身份验证带到其他地方
- 为非Google用户提供某种临时的Google授权 除了查看该日历之外,这对其他任何事情都没有好处.
- Use my own site's authentication, maybe from the server side, to retrieve the calendar and display it somehow without giving the user that Google authentication they could take somewhere else
- Give non-Google users some kind of temporary Google authorization that's not good for anything but viewing that calendar.
下面是其中嵌入了日历标准的页面作为示例.
Below is the page with a standard embed for the calendar as an example.
@{
ViewBag.Title = "Calendar";
}
<h2>Calendar</h2>
<iframe src="https://calendar.google.com/calendar/embed?src=sharing.thelangschool.org_hrq83e34uldebnrcd4hptop0ps%40group.calendar.google.com&ctz=America/New_York" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
推荐答案
您应使用服务帐户 https://developers.google.com/identity/protocols/OAuth2ServiceAccount 并与该服务帐户的电子邮件地址共享您的日历.然后,您的应用可以使用服务帐户的凭据来显示事件.
You should use a service account https://developers.google.com/identity/protocols/OAuth2ServiceAccount and share your calendar with this service account's email address. Then your app can use the service account's credentials to display the events.
这篇关于嵌入Google日历后,只有登录到我的网站(不一定通过Google)的用户才能看到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!