Skip to content

Instantly share code, notes, and snippets.

View vishva8kumara's full-sized avatar

Vishva Kumara vishva8kumara

View GitHub Profile
@vishva8kumara
vishva8kumara / handle.post.body.node.js
Last active October 26, 2017 11:49
HTTP - Handler for multi-part POST request/response body
var fs = require('fs');
function handlePost(req, callback){
var body = '';
// Receive multiple chunks
req.on('data', function (data){
body += data;
});
// All chunks received
req.on('end', function (data){
@vishva8kumara
vishva8kumara / info-lk.php
Last active August 20, 2017 14:23
info.lk minal OAuth Client Library
<?php
session_start();
//
// Consent denied by user
if (isset($_SESSION['info-lk']['ra']) && isset($_GET['error']))
$_SESSION['info-lk']['error'] = 'access denied';
//
// Process received single use token
else if (isset($_SESSION['info-lk']['ra']) && isset($_GET['code'])){
if (!isset($_GET['state']) || $_SESSION['info-lk']['nx'] != $_GET['state'])