Redirect to Google Calendar Add Event - fullcalendar

Is there a simple way where i could use Javascript to let user to add system's events to their Google Calendar event? What i need to accomplish here is, when the user clicks on the event on the calendar, there will be a popup that prompt user to sign in to Google (OAuth 2.0), and then the user will be redirected to the Google page for creating event. While the event's data that the user will add, is sent through Javascript. I use Fullcalendar from https://fullcalendar.io/js/fullcalendar-3.6.1 .
I have already go through the fullcalendar.io docs and i cannot found how to do this.
Any link for my reference? I need that API from Google that allow me to do this.

It is not a complete solution but a simple redirect to the google calendar page with path params might be helpful.
https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210528T065000Z/20210528T070000Z&text=cool+event
this will open google calendar UI with your date and event details.

Related

Sign In With Google - Trigger sign in programatically instead of button

I'm trying to migrate to the new Sign In With Google and I'm missing one crucial functionality I was using previously.
Basicly my application is working with locally created application users. At one point in the application, the user is prompted to login with Google Account to confirm that he's the correct user that will do some Google API action. I was able to achieve that with following code from the soon deprecated Google Sign-In library:
const auth = gapi.auth2.getAuthInstance();
if (!auth.isSignedIn.get())
await auth.signIn({
prompt: "select_account",
login_hint: employeeEmail
});
...
And it worked just fine. Now all the above methods are being deprecated and there are no direct replacements, or at least I don't understand how to achieve the same result. I am able to confirm the user identity by checking the id token received by using:
google.accounts.id.initialize({/*options*/);
...
google.accounts.id.prompt();
But if there's no google session active for the user, nothing happens.
The only way to actually trigger the Sign In is to click the Google Sign In Button, rendered using:
google.accounts.id.renderButton(htmlElement, {/*options*/});
After the button is clicked, the sign in popup is shown and everything is fine, the callback of the initialize configuration is called and the flow is resumed.
The problem is, how do I trigger the Sign In popup programatically? All of the above starts with a specific button click on my website.
FYI
I actually managed to reproduce almost the same behavior with the new API. It might not be the most elegant way of doing this, but I replaced the signIn method from my post above with google.accounts.oauth2.initTokenClient. Even though it should be used to only receive the tokens, it will also create a valid Google session that then can be detected by using silent auth (prompt: "none");

Segment to exclude based on a page view and an event

We have a website that provides information about our SAAS product, it also has a login button that redirects our users to the saas app that is on another domain.
I want to create a segment that excludes these users from our analytics, they all take the same journey of hitting the home page then clicking login which fires the event.
How can I achieve this, I can see how to filter for an event and path but not exclude if both these happen
On the Analytics page:
Configure -> Audiences -> Create custom audience
Here you may choose on which conditions the users will be included in this audience. The idea is to include all users except those who clicked on the login button. So as a condition you can specify click event and make sure that it was not on the login button, and how to achieve that depends on your metrics.

Google OAuth conditional scope, requestPermissions

I am using the Meteor Account package for OAuth login with google.
My use case is to allow users to login with google. And later, provide them options to opt for linking to Google calendar.
i.e by default I need only email/profile scope during login. And, when the user clicks the button inside the app ( like Update events to my Google calendar ), I want to get the permissions for accessing https://www.googleapis.com/auth/calendar.events.
One option I figured out is to call LoginWithGoogle the second time with the requestPermissions.
My questions are,
Is this the correct way?
If so, how do I prompt the user to provide permission ( without further button click) if the user is denied or revoked this access later point? i.e when getting 403 - insufficientPermissions error.
What are the exceptions that I need to take care of?
Your help is highly appreciated.

Google analytics and Oauth (Facebook login)

TL;DR;
Facebook login makes the original referral URL change since and in GA it will look like they originally came from a Facebook.
We have the following problem using Google Analytics (UA) for Facebook (Oauth) login:
user lands on /page/1?utm_campaign=aaa and GA session is created with correct initial referrer, campaign etc.
user visits a few other pages and decides to register using Facebook
Facebook login makes the user's browser to go to facebook and come back which changes the referral and thus creates a new GA session
When user lands back on our callback url we fire an event that is converted to goal in GA
The problem is that all users who register using Oauth have the referral set to Facebook and the landing page to the page where they land after Facebook's callback because that's when GA "resets" the session :( .
Is there a way of joining the two sessions in GA and making it know that it is the same user all the time so that Facebook registers keep the full information on initial referrer, landing page, UTMs etc. ?
Follow FB SDK example and OAuth dialog will open in a popup window.
It will remove the issue with GA.
Most of OAuth providers that I know also support opening a dialog in a popup window.

ajax rating control with facebook login

I have a video website. I want the users to vote for the videos with their facebook ids. What i want is to put an ajax rating control under videos. If the user is currently logged in on facebook, when the user clicks the control to rate the video i want to get the user id of the facebook user. If the user is not logged in I want to show a modal popup for facebook login and get the user id after user is logged in.
Any help would be appreciated.
Thanks.
If I am not wrong you will have to go all the way and create an App in Facebook and integrate it with your site.
You may first want to check the Javascript SDK
http://developers.facebook.com/docs/reference/javascript/
If that doesn't work, I have a blog article that does the full server side integration
http://theocdcoder.com/tutorial-integrating-facebook-authentication-asp-net-mvc-3/

Resources