caiya / eggjs-oauth2-server Goto Github PK
View Code? Open in Web Editor NEW基于eggjs的oAuth2.0授权服务端,包含完整流程实例
基于eggjs的oAuth2.0授权服务端,包含完整流程实例
$ npm run dev
[email protected] dev D:\github\eggjs-oAuth2-server
egg-bin dev
2018-03-24 15:09:15,391 INFO 12032 [master] egg version 2.1.0
Sat, 24 Mar 2018 07:09:16 GMT sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators at node_modules\sequelize\lib\sequelize.js:236:13
2018-03-24 15:09:26,860 WARN 14068 [egg:core:ready_timeout] 10 seconds later D:\github\eggjs-oAuth2-server\node_modules\egg-sequelize\lib\loader.js:42:7 was still unable to finish.
2018-03-24 15:09:26,922 ERROR 14068 nodejs.SequelizeConnectionError: connect ETIMEDOUT
at Utils.Promise.tap.then.catch.err (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:149:19)
From previous event:
at ConnectionManager.connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:136:13)
at sequelize.runHooks.then (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:50)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at ConnectionManager._connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:8)
at ConnectionManager.getConnection (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:257:46)
at Promise.try (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:538:92)
From previous event:
at Sequelize.query (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:445:23)
at Sequelize.authenticate (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:768:17)
at D:\github\eggjs-oAuth2-server\node_modules\egg-sequelize\lib\loader.js:43:21
at Generator.next ()
at onFulfilled (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:65:19)
at D:\github\eggjs-oAuth2-server\node_modules\co\index.js:54:5
at new Promise ()
at co (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:50:10)
at createPromise (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:30:15)
at Object.callFn (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\utils\index.js:44:42)
at process.nextTick (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\egg.js:221:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:678:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
name: 'SequelizeConnectionError'
parent: { Error: connect ETIMEDOUT at Connection._handleTimeoutError (D:\github\eggjs-oAuth2-server\node_modules\mysql2\lib\connection.js:194:13) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) From previous event: at ConnectionManager.connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:92:12) at sequelize.runHooks.then (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:50) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5) From previous event: at ConnectionManager._connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:8) at ConnectionManager.getConnection (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:257:46) at Promise.try (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:538:92) From previous event: at Sequelize.query (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:445:23) at Sequelize.authenticate (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:768:17) at D:\github\eggjs-oAuth2-server\node_modules\egg-sequelize\lib\loader.js:43:21 at Generator.next () at onFulfilled (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:65:19) at D:\github\eggjs-oAuth2-server\node_modules\co\index.js:54:5 at new Promise () at co (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:50:10) at createPromise (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:30:15) at Object.callFn (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\utils\index.js:44:42) at process.nextTick (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\egg.js:221:13) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:678:11) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 errorno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', fatal: true }
original: { Error: connect ETIMEDOUT at Connection._handleTimeoutError (D:\github\eggjs-oAuth2-server\node_modules\mysql2\lib\connection.js:194:13) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) From previous event: at ConnectionManager.connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:92:12) at sequelize.runHooks.then (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:50) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5) From previous event: at ConnectionManager._connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:8) at ConnectionManager.getConnection (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:257:46) at Promise.try (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:538:92) From previous event: at Sequelize.query (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:445:23) at Sequelize.authenticate (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:768:17) at D:\github\eggjs-oAuth2-server\node_modules\egg-sequelize\lib\loader.js:43:21 at Generator.next () at onFulfilled (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:65:19) at D:\github\eggjs-oAuth2-server\node_modules\co\index.js:54:5 at new Promise () at co (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:50:10) at createPromise (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:30:15) at Object.callFn (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\utils\index.js:44:42) at process.nextTick (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\egg.js:221:13) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:678:11) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 errorno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', fatal: true }
pid: 14068
hostname: DESKTOP-39J59UF
2018-03-24 15:09:26,922 ERROR 14068 nodejs.SequelizeConnectionError: connect ETIMEDOUT
at Utils.Promise.tap.then.catch.err (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:149:19)
From previous event:
at ConnectionManager.connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:136:13)
at sequelize.runHooks.then (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:50)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
at ConnectionManager._connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:8)
at ConnectionManager.getConnection (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:257:46)
at Promise.try (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:538:92)
From previous event:
at Sequelize.query (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:445:23)
at Sequelize.authenticate (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:768:17)
at D:\github\eggjs-oAuth2-server\node_modules\egg-sequelize\lib\loader.js:43:21
at Generator.next ()
at onFulfilled (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:65:19)
at D:\github\eggjs-oAuth2-server\node_modules\co\index.js:54:5
at new Promise ()
at co (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:50:10)
at createPromise (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:30:15)
at Object.callFn (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\utils\index.js:44:42)
at process.nextTick (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\egg.js:221:13)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:678:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
name: 'SequelizeConnectionError'
parent: { Error: connect ETIMEDOUT at Connection._handleTimeoutError (D:\github\eggjs-oAuth2-server\node_modules\mysql2\lib\connection.js:194:13) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) From previous event: at ConnectionManager.connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:92:12) at sequelize.runHooks.then (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:50) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5) From previous event: at ConnectionManager._connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:8) at ConnectionManager.getConnection (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:257:46) at Promise.try (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:538:92) From previous event: at Sequelize.query (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:445:23) at Sequelize.authenticate (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:768:17) at D:\github\eggjs-oAuth2-server\node_modules\egg-sequelize\lib\loader.js:43:21 at Generator.next () at onFulfilled (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:65:19) at D:\github\eggjs-oAuth2-server\node_modules\co\index.js:54:5 at new Promise () at co (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:50:10) at createPromise (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:30:15) at Object.callFn (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\utils\index.js:44:42) at process.nextTick (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\egg.js:221:13) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:678:11) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 errorno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', fatal: true }
original: { Error: connect ETIMEDOUT at Connection._handleTimeoutError (D:\github\eggjs-oAuth2-server\node_modules\mysql2\lib\connection.js:194:13) at ontimeout (timers.js:475:11) at tryOnTimeout (timers.js:310:5) at Timer.listOnTimeout (timers.js:270:5) From previous event: at ConnectionManager.connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\mysql\connection-manager.js:92:12) at sequelize.runHooks.then (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:50) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5) at processImmediate [as _immediateCallback] (timers.js:722:5) From previous event: at ConnectionManager._connect (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:327:8) at ConnectionManager.getConnection (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\dialects\abstract\connection-manager.js:257:46) at Promise.try (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:538:92) From previous event: at Sequelize.query (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:445:23) at Sequelize.authenticate (D:\github\eggjs-oAuth2-server\node_modules\sequelize\lib\sequelize.js:768:17) at D:\github\eggjs-oAuth2-server\node_modules\egg-sequelize\lib\loader.js:43:21 at Generator.next () at onFulfilled (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:65:19) at D:\github\eggjs-oAuth2-server\node_modules\co\index.js:54:5 at new Promise () at co (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:50:10) at createPromise (D:\github\eggjs-oAuth2-server\node_modules\co\index.js:30:15) at Object.callFn (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\utils\index.js:44:42) at process.nextTick (D:\github\eggjs-oAuth2-server\node_modules\egg-core\lib\egg.js:221:13) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) at Function.Module.runMain (module.js:678:11) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 errorno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', fatal: true }
pid: 14068
hostname: DESKTOP-39J59UF
2018-03-24 15:09:26,922 ERROR 14068 [agent_worker] start error, exiting with code:1
2018-03-24 15:09:26,924 ERROR 14068 [agent_worker] exit with code:1
2018-03-24 15:09:26,935 ERROR 12032 nodejs.AgentWorkerDiedError: [master] agent_worker#1:14068 died (code: 1, signal: null)
at Master.onAgentExit (D:\github\eggjs-oAuth2-server\node_modules\egg-cluster\lib\master.js:313:17)
at emitOne (events.js:116:13)
at Master.emit (events.js:211:7)
at Messenger.sendToMaster (D:\github\eggjs-oAuth2-server\node_modules\egg-cluster\lib\utils\messenger.js:122:17)
at Messenger.send (D:\github\eggjs-oAuth2-server\node_modules\egg-cluster\lib\utils\messenger.js:87:12)
at ChildProcess.agentWorker.once (D:\github\eggjs-oAuth2-server\node_modules\egg-cluster\lib\master.js:212:22)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
name: 'AgentWorkerDiedError'
pid: 12032
hostname: DESKTOP-39J59UF
2018-03-24 15:09:26,935 ERROR 12032 [master] agent_worker#1:14068 start fail, exiting with code:1
2018-03-24 15:09:26,935 ERROR 12032 [master] exit with code:1
DEBUG=common-bin
for detail
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: egg-bin dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\Program Files\nodejs\node_cache_logs\2018-03-24T07_09_26_958Z-debug.log
密码模式和刷新码模式本地线上都可以,授权码模式在本地可以跑通,上线后加HTTPS就出问题了。
而且问题是出在一开始,只走了 oauth.js 里的第一步,getClient。getUser 后面的就没有执行了,直接 500。
错误信息:“{"code":"ERR_ASSERTION","message":"Internal Server Error"}”
debug了一天多,实在是不知道问题出在哪,求指教,谢谢。
Connect timeout for 3000ms, POST http://192.168.20.131:7001/users/token -2 (connected: false, keepalive socket: false, agent status: {"createSocketCount":1,"createSocketErrorCount":0,"closeSocketCount":1,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":0,"freeSockets":{},"sockets":{},"requests":{}}, socketHandledRequests: 1, socketHandledResponses: 0) headers: {
现在好像会报错
认证既然用 koa-jwt 怪不得一直报错 401的错误
你好,能说下修改数据库地址的具体文件和具体位置吗?我是新手,还请您说详细点,谢谢了!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.