From 8b1819f69dd17cf38cf4f75d655f00a56613f05e Mon Sep 17 00:00:00 2001 From: Joel Schneider Date: Sat, 28 Apr 2018 11:38:27 -0400 Subject: [PATCH] fix: github provider (#159) --- docs/providers/github.md | 7 ++++--- lib/providers/_utils.js | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/providers/github.md b/docs/providers/github.md index 1e7a6a691..10aff9914 100644 --- a/docs/providers/github.md +++ b/docs/providers/github.md @@ -8,7 +8,8 @@ auth: { strategies: { github: { - client_id: '...' + client_id: '...', + client_secret: '...' }, } } @@ -22,7 +23,7 @@ this.$auth.loginWith('github') 💁 This provider is based on [oauth2 scheme](../schemes/oauth2.md) and supports all scheme options. -### Obtaining `client_id` +### Obtaining `client_id` and `client_secret` -This option is **REQUIRED**. To obtain one, create your app in [Create a new Oauth APP](https://github.com/settings/applications/new) and use provided "Client ID". +This option is **REQUIRED**. To obtain one, create your app in [Create a new Oauth APP](https://github.com/settings/applications/new) and use provided "Client ID" and "Client Secret". diff --git a/lib/providers/_utils.js b/lib/providers/_utils.js index ea401820c..99496c63c 100644 --- a/lib/providers/_utils.js +++ b/lib/providers/_utils.js @@ -21,8 +21,8 @@ function addAuthorize (strategy) { // Set response_type to code strategy.response_type = 'code' - // Json parser - const jsonMiddleware = bodyParser.json() + // Form data parser + const formMiddleware = bodyParser.urlencoded() // Register endpoint this.options.serverMiddleware.unshift({ @@ -32,7 +32,7 @@ function addAuthorize (strategy) { return next() } - jsonMiddleware(req, res, () => { + formMiddleware(req, res, () => { const { code } = req.body if (!code) {