Target google calendar when using jwt access - node.js

I use google-api-nodejs-client to access my calendar on server side application. My app's user is only for me, so I use jwt access via service account.
After setting up a service account on Google Developers Console, I could get/insert events to calendar via google api library. But I couldn't find any events in Google calendar on web browser. Of course I use a same google account for setting service account on developers console and checking google calendar web app.
Perhaps if I use a service account, is a special calendar created? Is it possible to get/insert events from/into my existing calendar via calendar id? I got an error when I set existing calendar id to get events, 'Not found'. I could only set 'primary' as a calendar_id.

I got an answer by myself. If I use existing calendars, I have to set 'sharing settings' to each calendar in google calendar.
Open google calendar
Go to calendar setting page
Open 'share setting' that calendar you want to use
add your service account email (xxx#developer.gserviceaccount.com) and set authorization level.
Then, I could access existing calendars!

Related

How can I programmatically seamlessly share a clients google calendar with a service account as automatically as possible

I am trying to share a service account with any user's calendar and would like to know if anyone knows how to do so on the backend which is node.js or the frontend which is flutter/dart so that the user has to do as little as possible to add the service account to their calendar.
When onboarding a user on the flutter/dart front end I would like to ask a user if a service account can be added to a calendar on their account so the system can handle certain scheduling tasks for the user. I am assuming that the user is not technical. Ideally, I would like to add a new calendar to the user's account and share the service account with that.
After onboarding I would like all actions which the system does with the users calendar to take place on a node.js server using the service account.
I would like the service account to be able to read events from the user's calendar, add events, and find times during which the user is not already booked.
I have searched the internet for many hours and there is very little information about how to do this.
Also, will using a service account to view and modify and find available times on a user's calendar only work with workplace calendars and not with free calendars?
There are services/methods available using Calendar API that can achieve the functionality you want, you may look into the following:
Method: users.list - for listing the users within your organization (as reference calendarId for the other methods needed)
Calendars:insert - for creating a secondary calendar.
Acl: update - for setting Access Control List to the created secondary calendar.
Events: list & Events: get - for listing and getting the specified event needed for modification.
Now, for creating and authorizing the service account for this, you may check this reference link for Authorizing Requests to the Google Calendar API.
Bear in mind that read/write access to events/calendars requires the correct scope as define on the link above.
Here's the OAuth 2.0 scope information for the Google Calendar API:
https://www.googleapis.com/auth/calendar read/write
access to Calendars
https://www.googleapis.com/auth/calendar.readonly read-only access to
Calendars https://www.googleapis.com/auth/calendar.events read/write
access to Events
https://www.googleapis.com/auth/calendar.events.readonly read-only
access to Events
https://www.googleapis.com/auth/calendar.settings.readonly read-only
access to Settings
https://www.googleapis.com/auth/calendar.addons.execute run as a
Calendar add-on
And lastly, service accounts have no rights/authorization to access personal Gmail accounts, since the Domain-wide delegation feature only applies to user accounts within your organization.

Does Instagram Graph API has sandbox mode?

The docs say (step 4):
In the App Review for Instagram section, click Add to Submission for each permission your App will need from its Users. instagram_basic is required. instagram_manage_comments, instagram_manage_insights, and instagram_content_publish are optional.
Scroll to the bottom of the page, and in the Current Submission sub-section, for each submission, click its View Notes link.
In the View Notes dialogue for each permission submission, provide a description for how you will use the data returned by any endpoints that require the permission, and a screencast showing how your app will use the data.
Once you've completed your notes for all of your permission submissions, click the Submit For Review button at the bottom of the page. Note that this is separate from your App Review, which you will do after testing.
After you've added both Facebook Login and Instagram API products to your app configuration, add Facebook Login to your app and record a screencast showing how you will use data returned by the Instagram API. This is similar to the Facebook Login screencast but with Instagram data, so the same guidelines apply.
Step 5:
Once you've been notified that your Instagram API product submission has been approved, you can use the Graph API Explorer to test your app.
With Facebook Login I can create an app that works in sandbox mode. Which lets me create a screencast. To be able to use Instagram Graph API (on a site) I need (from what I can gather):
Facebook Page linked to Instagram Business Account
an app icon
a privacy policy page
a site with working Facebook Login
description of how each permission is going to be used
screencast of... what exactly? of a site that is basically ready, but instead of fetching data from Instagram, it has them hardcoded in the code?
Or there is a sandbox mode after all?
UPD I've highlighted the important parts in the quotes above. Then:
5. Test Your App
Once you've been notified that your Instagram API product submission has been approved, you can use the Graph API Explorer to test your app.
Go to the Graph API Explorer...
The first call you will make is to the Graph API's /user/accounts edge...
Locate the Page that you connected to the Instagram Business Account and click its ID...
Next, [make /page?fields=instagram_business_account request].
This is where I get empty response in Graph API Explorer (only id field is returned), or:
200:- OAuthException:(#200) Access to this data is temporarily disabled for non-active apps or apps that have not recently accessed this data due to changes we are making to the Facebook Platform. https://developers.facebook.com/status/issues/205942813488872/
GET /...?fields=instagram_business_account HTTP/1.1
on my site. Which requests to Instagram Graph API can I make before passing reviews (Instagram App Review, and Facebook App Review)?
It looks like the documentation that Facebook provides is somewhat misleading. You can actually use Instagram Graph API via Graph API Explorer (or by sending GET requests from your code) in a very limited way accessing only your instagram business account BEFORE you get initial approval described in Step 4.
Steps:
Open Graph API Explorer.
First, you need to add extra permissions in the "Access Token" section. There is a "Add a Permission" drop down on the bottom of that section. Open that drop down and select: instagram_basic, manage_pages, business_management permissions. Depending on what you are trying to do, you may need other permissions as well (e.g. instagram_manage_comments, ads_management, manage_pages).
Once you selected the extra permissions, click on the "Get Access Token" button.
Now, you have access token with correct permissions and you should be able to execute instagram_business_account request. This will return the instagram id of your business account, which you can then use for other requests.
After going through these steps, I'm able to get media for my business account via Instagram Graph API, although I'm still trying to figure out why tags request returns empty list.
Go to your app dashboard from your developer account:
https://developers.facebook.com/apps/APP_ID/dashboad
Go to: Roles -> Test Users.
Edit one of the test users to change its password to what you want in order to know him.
Once done, logout from your personal account and connect with the "test user" account in https://facebook.com
Go to your app and click the facebook login with the scope "instagram_basic".
With the access_token that you get you are able to ask Graph API about the user's instagram business account.
Et voilĂ .
PS: You will not be able to use the Open Graph API tool from your test user. My advice is to test your app from Incognito mode so it will not interpose with your personal account.
UPDATE
Currently, access the instagram data from this way is disabled but this is the right way to access the data.
FB error message says:
(#200) Access to this data is temporarily disabled for non-active apps or apps that have not recently accessed this data due to changes we are making to the Facebook Platform. https://developers.facebook.com/status/issues/205942813488872/
You can get full functionality of Graph API if you login with the developer account, use that to create a video screencast of app functionality and submit
You will have to create a test application out of your real application, these applications are in sand box mode by default (developer mode) https://developers.facebook.com/docs/apps/test-apps/ You will be able to access any fb permission / feature with it, and develop a product with it. Once you are ready to review, in your submission of your real application link your test app in the process

Google API Service Account - Can't Access Private Data

Trying to access my personal calendar data using a service account.
I've gone through the setup for creating a service account (with owner permissions). Using NodeJS, I've successfully made requests to my public calendar, but not my private calendars. ( the same result using googleapis and google-OAuth-jwt packages)
Everything that I've searched shows that I need to give "domain-wide authority", BUT, I do not have a G Suite account, so I don't believe this applies to me.
So the question is, can one access their own personal calendar data using a service account? What might I be missing?
You may refer with this SO post. It stated that the service account has its on Google calendar account so if you are trying to read one of your personal calendars, you are going to share it with the service account. You can check the example given using the Json service account key file.
Answer in comments, thanks to abielita. Link to answer.
Remember service accounts are not you. The service account has its own Google calendar account so if you are trying to read one of your personal calendars you are going to have to share it with the service account.
Shared the calendar with my service account.

Do not have "Go to admin" menu when creating docusign account using REST API

We are using DocuSign REST API (DocuSign C# Client) to create a DocuSign account for our clients. An account is created successfully, but when the user login that account on DocuSign Web (New UI) then they do not get "Go to Admin" menu in admin preferences. Is there any settings that we need to apply while creating DocuSign account. We are using DocuSign C# Client to create an account and applying only email and user name.
Also, we want to update some DocuSign account settings using REST API. But some parameters are not getting updated. When I checked the API log and found that parameter which we want to modify its read only. Below what i found from API log.
"allowEnvelopeCorrect":"false","allowEnvelopeCorrectMetadata":{"rights":"read_only","uiHint":"available"}
See my answer below on another thread, I would try to explicitly call canManageAccount and see if the permission gets set. It may still need to be done in SOAP.
Fail to update user's "Manage Account" permission through "Modify User Account Settings" API
Are you creating new accounts through the API or just adding new users to an account?
There's actually a bug in the platform currently that will be fixed soon - the bug is that for single user accounts the Go To Admin link in the menu drop menu is not available. I believe this might be causing your issue. Starting tomorrow you should be able to access the Admin menu directly through - admin.docusign.com/auth - and I think next week the actual menu item should be enabled and bug fixed.
-- By Ergin
It has been fixed Now.. Thanks.

Google Calendar API public holidays

Using the Node https://github.com/google/google-api-nodejs-client library I am trying to access public holidays. I have the auth working and have access to the API. When I test the events. list endpoints with API explorer it works, I suspect that the calendar
calendarId :'en.sa#holiday#group.v.calendar.google.com'
exists in my personal calendar but not in the apps calendar.
When I try to get the list of calendars in my node app the list is empty:
calendar.calendarList.list({auth: jwtClient}, calenderGetComplete);
So the events.list doesnt find the calendar.
calendar.events.list({ calendarId :'en.sa#holiday#group.v.calendar.google.com', auth: jwtClient}, calenderGetComplete);
So on a personal calendar, one can add other interesting calendars, like the public holiday one, but seems like you can't do it for the calendar the app is using? Seems like the public calendars don't have 'interesting calendars'?
I am not sure how it is you are authenticating Oauth2 or a service account?
There is a difference between calendar lists and calendars. The calendar list is just that little list on the bottom left-hand side of the google calendar website it has no real purpose (IMO). If you are using a service account and grant it access to one of your personal (ex: chrisMalherbe at gmail.com) Google calendars it will have access to it but it won't appear in the service accounts calendar. list unless you insert it there manually. When you add one of these interesting calendars to your personal google calendar page (ex: chrisMalherbe at gmail.com) the website automatically adds it to the calendar. list for you.
It doesn't really need to be there.
As for public calendars, everyone has access and they don't need to be on the calendar list. They are public you can create a public API key and request data from them. I am not sure what calendar en.sa is but I would take your API key and dump this in a web browser just to make sure there is data. If memory serves there are a few with no data, and the data only goes a year ahead I think so if you are looking for holidays in 2020 there won't be any data.
GET https://www.googleapis.com/calendar/v3/calendars/en.sa#holiday#group.v.calendar.google.com/events?key=[APIKey]
Or with an access token if you don't want to use a public API key
GET https://www.googleapis.com/calendar/v3/calendars/en.sa#holiday#group.v.calendar.google.com/events?access_token=[accesstoken]
I am not a node.js expert but I found this node-google-api it might help I have a tutorial on this its mostly explains how public calendars work however it's in C# may or may not be of any help to you. Public Google Calendars with C#

Resources