pihentagy
pihentagy8mo ago

Google Calendar

Hi! I am looking for a minimal example how to access google calendar API. I already obtained credentials.json form Google, just would like to have a minimal "hello world" of Google calendars. Like list all of my calendars. I am stuck at this point: how to assemble a CredentialsClient? https://doc.deno.land/https://googleapis.deno.dev/v1/calendar:v3.ts/~/CredentialsClient ps: is this a good place to ask it? I cannot find a good relevant label, which signals maybe I'm not at the right place…
googleapis.deno.dev/v1/calendar:v3.ts – CredentialsClient | Deno Doc
Defines the root interface for all clients that generate credentials for calling Google APIs. All clients should implement this interface.
7 Replies
Deno AI Helper
Deno AI Helper8mo ago
Hello! I've checked the official Deno documentation and couldn't find a specific example for accessing the Google Calendar API using Deno. However, I can provide some general guidance based on the information you've provided in your message. Firstly, it's important to note that my advice is not based on the Deno documentation, so please double-check the accuracy of the advice given. From what you've described, it sounds like you're trying to create a CredentialsClient to interact with the Google Calendar API. Typically, to access Google APIs, you would need to use OAuth 2.0 for authorization. The process usually involves creating an OAuth client, obtaining an access token, and then using that token to make authenticated requests to the API. Here's a very high-level and generic example of steps you might follow, but please note that this is not a Deno-specific example and you should refer to the appropriate libraries and documentation for Deno: 1. Load your credentials.json file to retrieve your client ID and client secret. 2. Use these credentials to create an OAuth client. 3. Generate an authorization URL and navigate to it to obtain an authorization code. 4. Exchange the authorization code for an access token. 5. Use the access token to make requests to the Google Calendar API. Since you mentioned a CredentialsClient, it seems like you might be referring to a specific library or module for Deno that I'm not aware of. If this is a third-party module, I would recommend looking at the module's documentation or repository for examples or further instructions. As for whether this is a good place to ask, you're welcome to ask Deno-related questions here, and we'll do our best to assist you. If your question is about a third-party library, you might also
Deno AI Helper
Deno AI Helper8mo ago
consider reaching out to the maintainers of that library or looking for a community specific to that library. Remember to always handle your credentials securely and never expose them in your code or to unauthorized parties.
rabbit_rabbit
rabbit_rabbit8mo ago
Hi @pihentagy — I ended up getting this working by hand rolling my own GoogleClient that makes fetch requests. Wading through all the docs was challenging! Perhaps the library you referenced works, but I haven't tested it. If the credentials.json object includes your access_token & refresh_token, this should work as it's working for me.
cdoremus
cdoremus8mo ago
Nice!! Can you provide the types.ts file too?
rabbit_rabbit
rabbit_rabbit8mo ago
@cdoremus here you are!
NDH
NDH8mo ago
Do I see a possible blog post there?
cdoremus
cdoremus8mo ago
Possibly once I finish my current post