如果 Client ID 和 Client Secret 正确, 访问github授权url时,会得到一个token
获得token即验证成功.
代码实现:
index.html
<html><head><scriptsrc="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script><scriptsrc="https://unpkg.com/axios/dist/axios.min.js"></script></head><body><divid="app"><ahref="http://localhost:3000/github/login">login with github</a></div></body></html>
目标
将开发中经常遇见的问题写在这里方便查询.
使用Koa创建一个简单的服务器
const Koa require("koa");
const app new Koa();
app.listen(3000, () >{console.log("[server] Server is running at http://localhost:3000")
})使用koa2-cors解决…