Skip to content

Instantly share code, notes, and snippets.

View gautamsi's full-sized avatar
🎯
Focusing

Gautam Singh gautamsi

🎯
Focusing
View GitHub Profile
@gautamsi
gautamsi / auth.ts
Created November 9, 2021 05:43
Firebase Auth with Keystone
import { KeystoneContext } from '@keystone-next/keystone/types';
import admin from 'firebase-admin';
const firebase = admin.initializeApp();
export const authMutations = `
authenticateWithFirebase(token: String!): User
signupWithFirebase(
token: String!
name: String!
email: String
@gautamsi
gautamsi / streamingtest.js
Last active May 20, 2018 00:44
Streaming Connection
"use strict";
var ews = require("ews-javascript-api");
var credentials = require("../credentials");
ews.EwsLogging.DebugLogEnabled = false;
var exch = new ews.ExchangeService(ews.ExchangeVersion.Exchange2013);
exch.Credentials = new ews.ExchangeCredentials(credentials.userName, credentials.password);
exch.Url = new ews.Uri("https://outlook.office365.com/Ews/Exchange.asmx");
exch.SubscribeToStreamingNotifications([new ews.FolderId(ews.WellKnownFolderName.Inbox)], ews.EventType.NewMail, ews.EventType.Created, ews.EventType.Deleted, ews.EventType.Modified, ews.EventType.Moved, ews.EventType.Copied, ews.EventType.FreeBusyChanged)
.then(function (streamingSubscription) {
var connection = new ews.StreamingSubscriptionConnection(exch, 1);
@gautamsi
gautamsi / appointment.ts
Last active June 3, 2023 01:44
Fetch Appointments using ews-javascript-api
import { ExchangeService, ExchangeVersion, WebCredentials, Uri, DateTime, CalendarView, WellKnownFolderName, EwsLogging } from "ews-javascript-api";
import credentials = require("./credentials"); //for username and password
EwsLogging.DebugLogEnabled = false;
var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials(credentials.userName, credentials.password);
service.Url = new Uri("https://outlook.office365.com/Ews/Exchange.asmx");
var view = new CalendarView(DateTime.Now.Add(-1, "week"), DateTime.Now); // appointments in last one week.
@gautamsi
gautamsi / cookiesAuthXHRAPI.js
Last active June 3, 2017 20:59
ews-javascript-api with cookies Authentication of TMG (Thread management Gateway) (or ISA Server)
var ews = require("ews-javascript-api");
var PromiseFactory = ews.PromiseFactory;
var request = require('httpreq');
var cookiesXHRApi = (function () {
function cookiesXHRApi(user, password) {
this.cookies = [];
this.userName = user;
this.password = password;
}
cookiesXHRApi.prototype.xhr = function (xhroptions) {
@gautamsi
gautamsi / ntlmXHRApi.js
Last active February 7, 2018 00:09
ews-javascript-api NTLM Auth with NodeJS
//see reference implementation in ews-javascript-api_repo@github\test\MockXHRApi.ts, this one is transpiled JS
// ----- Updated to process errors in ntlm library gracefully
var PromiseFactory = require("ews-javascript-api").PromiseFactory;
var httpntlm = require('httpntlm');
var ntlmXHRApi = (function () {
function ntlmXHRApi(user, password) {
this.userName = user;
this.password = password;
}
ntlmXHRApi.prototype.xhr = function (xhroptions) {