├── .gitignore ├── coverage ├── lcov-report │ ├── sort-arrow-sprite.png │ ├── prettify.css │ ├── index.html │ ├── alexa-skill-local │ │ ├── index.html │ │ └── authServer.js.html │ ├── sorter.js │ ├── base.css │ └── prettify.js ├── lcov.info └── coverage.json ├── .travis.yml ├── html ├── close.html └── index.html ├── test ├── endpointController.js └── authServer.js ├── authServer.js ├── .vscode └── launch.json ├── mockLambdaServer.js ├── LICENSE ├── package.json ├── README.md ├── bin └── start.js └── endpointController.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /.vscode/ 3 | -------------------------------------------------------------------------------- /coverage/lcov-report/sort-arrow-sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itachiRedhair/alexa-skill-local/HEAD/coverage/lcov-report/sort-arrow-sprite.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - stable 5 | 6 | install: 7 | - npm install 8 | 9 | script: 10 | - npm run cover 11 | 12 | after_script: "cat coverage/lcov.info | node_modules/coveralls/bin/coveralls.js" -------------------------------------------------------------------------------- /html/close.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 || File | 50 |51 | | Statements | 52 |53 | | Branches | 54 |55 | | Functions | 56 |57 | | Lines | 58 |59 | |
|---|---|---|---|---|---|---|---|---|---|
| alexa-skill-local/ | 63 |100% | 65 |18/18 | 66 |100% | 67 |0/0 | 68 |100% | 69 |1/1 | 70 |100% | 71 |18/18 | 72 |
| File | 50 |51 | | Statements | 52 |53 | | Branches | 54 |55 | | Functions | 56 |57 | | Lines | 58 |59 | |
|---|---|---|---|---|---|---|---|---|---|
| authServer.js | 63 |100% | 65 |18/18 | 66 |100% | 67 |0/0 | 68 |100% | 69 |1/1 | 70 |100% | 71 |18/18 | 72 |
| 1 47 | 2 48 | 3 49 | 4 50 | 5 51 | 6 52 | 7 53 | 8 54 | 9 55 | 10 56 | 11 57 | 12 58 | 13 59 | 14 60 | 15 61 | 16 62 | 17 63 | 18 64 | 19 65 | 20 66 | 21 67 | 22 68 | 23 69 | 24 70 | 25 71 | 26 72 | 27 | 1× 73 | 1× 74 | 1× 75 | 1× 76 | 1× 77 | 78 | 1× 79 | 80 | 1× 81 | 1× 82 | 83 | 1× 84 | 1× 85 | 1× 86 | 1× 87 | 1× 88 | 89 | 90 | 1× 91 | 92 | 1× 93 | 2× 94 | 2× 95 | 96 | 2× 97 | 98 | | const express = require('express');
99 | const http = require('http');
100 | const bodyParser = require('body-parser')
101 | const app = express();
102 | const nodemon = require('nodemon');
103 |
104 | let accessToken = null;
105 |
106 | app.use(bodyParser.json());
107 | app.use(express.static(__dirname + '/html'));
108 |
109 | app.get('/oauth2/callback', (req, res) => {
110 | accessToken = req.query.access_token;
111 | res.sendFile(__dirname + '/html/close.html');
112 | httpServer.close();
113 | httpServer.emit('access-token', accessToken);
114 | });
115 |
116 | const httpServer = http.createServer(app);
117 |
118 | module.exports = function intiAuthServer() {
119 | httpServer.listen(3001, () => {
120 | console.log('Open in your browser and login with Amazon ==> http://localhost:3001')
121 | });
122 | return httpServer;
123 | }
124 | |