Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// some providers return wrong `content-type` like: text/html or text/plain
else {
try {
body = JSON.parse(body)
}
catch (err) {
// use qs instead of querystring for nested objects
body = qs.parse(body)
}
}
return {options, res, body, raw}
}
module.exports = require('request-compose').extend({
Request: {oauth: require('request-oauth')},
Response: {parse}
}).client
var t = require('assert')
var request = require('request-compose').extend({
Request: {cookie: require('request-cookie').Request},
Response: {cookie: require('request-cookie').Response},
}).client
var hapi = parseInt(require('hapi/package.json').version.split('.')[0])
var port = {auth: 5000, app: 5001}
var url = {
auth: (path) => `http://localhost:${port.auth}${path}`,
app: (path) => `http://localhost:${port.app}${path}`,
}
var provider = require('./util/provider')
var client = require('./util/client')
var t = require('assert')
var request = require('request-compose').extend({
Request: {cookie: require('request-cookie').Request},
Response: {cookie: require('request-cookie').Response},
}).client
var hapi = parseInt(require('hapi/package.json').version.split('.')[0])
var port = {oauth1: 5000, oauth2: 5001, app: 5002}
var url = {
oauth1: (path) => `http://localhost:${port.oauth1}${path}`,
oauth2: (path) => `http://localhost:${port.oauth2}${path}`,
app: (path) => `http://localhost:${port.app}${path}`,
}
var provider = require('./util/provider')
var client = require('./util/client')
var t = require('assert')
var urlib = require('url')
var http = require('http')
var qs = require('qs')
var request = require('request-compose').extend({
Request: {cookie: require('request-cookie').Request},
Response: {cookie: require('request-cookie').Response},
}).client
var express = require('express')
var session = require('express-session')
var Koa = require('koa')
var koasession = require('koa-session')
var mount = require('koa-mount')
var convert = require('koa-convert')
var koaqs = require('koa-qs')
var Hapi = require('hapi')
var yar = require('yar')
var t = require('assert')
var request = require('request-compose').extend({
Request: {cookie: require('request-cookie').Request},
Response: {cookie: require('request-cookie').Response},
}).client
var port = {oauth2: 5001, app: 5002}
var url = {
oauth2: (path) => `http://localhost:${port.oauth2}${path}`,
app: (path) => `http://localhost:${port.app}${path}`,
}
var provider = require('./util/provider')
var client = require('./util/client')
describe('middleware', () => {
var server = {oauth2: null}
var express = require('express')
var session = require('express-session')
var grant = require('grant-express')
var request = require('request-compose').extend({
Request: {oauth: require('request-oauth')}
}).client
var config = require('./config.json')
express()
.use(session({secret: 'grant', saveUninitialized: true, resave: true}))
.use(grant(config))
.get('/hello', async (req, res) => {
var {body} = await request({
url: 'https://graph.facebook.com/me',
headers: {authorization: `Bearer ${req.query.access_token}`}
})
res.end(JSON.stringify({oauth: req.query, profile: body}, null, 2))