Integrate my website with google calendar

2019-05-18 14:22发布

Im developing a website in PHP. The users of this site are allowed to book appointments from the calendar that i have provided. When a user makes a booking it should be added to my google calendar.

What kind of authentication mechanism would i need for this type of scenario? Which one from the following? 1. Web applications 2. Service accounts 3. Installed applications

NB: I dont want to access my site user's google calendar. I just want their booking be shown in my google calendar. And, if possible, please post a source where i can get started on the coding. I searched but most tutorials on this topic are based on .NET.

Thanks.

1条回答
冷血范
2楼-- · 2019-05-18 15:13

You will need to setup an OAuth interface with the Google Calendar API. But instead of using OAuth to connect to the user's Google Calendar, you will set it up so that it always connects to your Google Calendar. If you go into the Google Documentation for the Calendar API, they have section called Write your First App. This has sample code in multiple languages including PHP. It's a good place to start.

NOTE: When I say that it will use your account, what I mean is that you set it up like you are a customer and connect via OAuth to get the tokens. Then save those tokens and use them for all accesses to Google Calendar. Since the tokens are into your account, you will always be connecting to your Calendar.

查看更多
登录 后发表回答