我一直在尝试使用这个外观优雅的包来通过 Jawbone API 进行身份验证。但我不断收到这个错误 -
我已经使用 Jawbone API 服务配置了我的“应用程序”以使用这些重定向 URI -
我的配置文件看起来像这样 -
module.exports = {
'server': {
'protocol' : 'https',
'host' : 'localhost',
'port' : 5000,
'callback' : '/done',
'transport' : 'session',
'state' : true
},
'jawbone' : {
'key' : '6f*********',
'secret' : '9b************************',
'callback' : '/connect/jawbone/callback',
'scope' : ['basic_read', 'sleep_read'],
}
}
var config = require('./config');
var express = require('express');
var session = require('express-session');
var Grant = require('grant-express');
var grant = new Grant(require('./config.js'));
var bodyParser = require('body-parser')
var app = express()
var Purest = require('purest');
var jawbone = new Purest({provider:'jawbone'});
var https = require('https');
var fs = require('fs');
var logger = require('morgan')
app.use(logger('dev'))
app.use(bodyParser.urlencoded({extended:true}));
app.use(session({secret:'grant'}));
app.use(grant);
app.get('/done', function (req, res) {
console.log(req.query);
res.end(JSON.stringify(req.query, null, 2));
});
/*
jawbone.get('users/@me', {
auth:{bearer:'[ACCESS_TOKEN]'}
}, function (err, res, body) {
// body is a parsed JSON object containing the response data
console.log(body);
})
*/
var sslOptions = {
key: fs.readFileSync('./.server.key'),
cert: fs.readFileSync('./.server.crt')
};
var secureServer = https.createServer(sslOptions, app).listen(config.server.port, function(){
console.log('Listening on port ' + config.server.port);
});
我假设我犯了一个菜鸟错误,并且可能误读了文档或示例。有人可以指出我配置错误的地方吗?