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.
11 Replies
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 alsoconsider 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.
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.Nice!! Can you provide the
types.ts
file too?@cdoremus here you are!
Do I see a possible blog post there?
Possibly once I finish my current post
any update?
I put a lot of effort into my blog post and was hoping for some GitHub sponsorships, but alas they were only a couple. So I've been pursuing other opportunities that make money. I'd certainly do this blog post if you can give me a substantial sponsorship.
I understand money is important. I cannot give you that unfortunately.
Non-monetary economy
A moneyless economy or nonmonetary economy is a system for allocation of goods and services without payment of money. The simplest example is the family household. Other examples include barter economies, gift economies and primitive communism.
Even in a monetary economy, there are a significant number of nonmonetary transactions. Examples incl...