There are 2 stand ways to call the google-apis,
- Use oauth client
- Use oauth server-to server applications
Concept.
For 1. The oauth flows are pretty standard for any oauth2 applications.
First you ask permission to the user that granted you to access the calendar.
Then there is a access_token and a refresh_token.
So that you can access user’s calendar via that access_token.
For 2. This is under the G-suite admin authority to manipulating G-suite users data
using a delegated account.
Create a service account and let that account has access to the data you want to manipulate.
First you ask permission to the user that granted you to access the calendar.
Then there is a access_token and a refresh_token.
So that you can access user’s calendar via that access_token.
For 2. This is under the G-suite admin authority to manipulating G-suite users data
using a delegated account.
Create a service account and let that account has access to the data you want to manipulate.
The flow charts are
For 1.
Get token using oauth2 => Initialize an google-apis client with token and scopes =>
Use client to send the api
For 2.
Create Service Account Client in the google console =>
Create Security in G-suite app using G-suite admin account =>
JWT can make request to access G-suite users
Get token using oauth2 => Initialize an google-apis client with token and scopes =>
Use client to send the api
For 2.
Create Service Account Client in the google console =>
Create Security in G-suite app using G-suite admin account =>
JWT can make request to access G-suite users
There are 3 approach ways.
- Using javascript under the react app. https://developers.google.com/identity/protocols/OAuth2UserAgent
- Using googleapis in could-functions in node.js.
Implementation details.
For 2.
- To create a service account as a delegate.
- Use the credential to authorize the JWTclient.
- Add that service account to the calendar you want to manipulate.
- Manipulate calendar using AWT like google apis.
Reference of creating google calendar, setup gcp project.
沒有留言:
張貼留言