From ff095ebe23a0e4099e0970dc81a1106649628578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Reina?= Date: Thu, 21 Jul 2022 10:54:11 +0200 Subject: [PATCH 1/3] Update custom reddit provider to v4 --- docs/docs/providers/reddit.md | 41 +++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/docs/docs/providers/reddit.md b/docs/docs/providers/reddit.md index a203e113ea..13f783686e 100644 --- a/docs/docs/providers/reddit.md +++ b/docs/docs/providers/reddit.md @@ -47,25 +47,28 @@ This Provider template only has a one hour access token to it and only has the " ```js providers: [ { - id: "reddit", - name: "Reddit", - clientId: process.env.REDDIT_CLIENT_ID, - clientSecret: process.env.REDDIT_CLIENT_SECRET, - scope: "identity mysubreddits read", //Check Reddit API Documentation for more. The identity scope is required. - type: "oauth", - version: "2.0", - params: { grant_type: "authorization_code" }, - accessTokenUrl: " https://www.reddit.com/api/v1/access_token", - authorizationUrl: - "https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent", - profileUrl: "https://oauth.reddit.com/api/v1/me", - profile: (profile) => { - return { - id: profile.id, - name: profile.name, - email: null, - } - }, + id: 'reddit', + name: 'Reddit', + clientId: process.env.REDDIT_CLIENT_ID, + clientSecret: process.env.REDDIT_CLIENT_SECRET, + authorization: { + url: 'https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent', + params: { scope: 'identity mysubreddits read' }, + }, + type: 'oauth', + version: '2.0', + token: { + url: 'https://www.reddit.com/api/v1/access_token', + params: { grant_type: 'authorization_code' }, + }, + userinfo: 'https://oauth.reddit.com/api/v1/me', + profile: profile => { + return { + id: profile.id, + name: profile.name, + email: null, + } + }, }, ] ``` From f8c1ec11efc7a4e35d3700d11ecc5165de0050c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gonz=C3=A1lez=20Reina?= Date: Sun, 24 Jul 2022 20:32:57 +0200 Subject: [PATCH 2/3] Reuse RedditProvider's default options --- docs/docs/providers/reddit.md | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/docs/docs/providers/reddit.md b/docs/docs/providers/reddit.md index 13f783686e..ad54577737 100644 --- a/docs/docs/providers/reddit.md +++ b/docs/docs/providers/reddit.md @@ -46,30 +46,19 @@ This Provider template only has a one hour access token to it and only has the " ```js providers: [ - { - id: 'reddit', - name: 'Reddit', - clientId: process.env.REDDIT_CLIENT_ID, - clientSecret: process.env.REDDIT_CLIENT_SECRET, - authorization: { - url: 'https://www.reddit.com/api/v1/authorize?response_type=code&duration=permanent', - params: { scope: 'identity mysubreddits read' }, - }, - type: 'oauth', - version: '2.0', - token: { - url: 'https://www.reddit.com/api/v1/access_token', - params: { grant_type: 'authorization_code' }, - }, - userinfo: 'https://oauth.reddit.com/api/v1/me', - profile: profile => { - return { - id: profile.id, - name: profile.name, - email: null, - } + RedditProvider({ + clientId: process.env.REDDIT_CLIENT_ID, + clientSecret: process.env.REDDIT_CLIENT_SECRET, + version: '2.0', + authorization: { + url: 'https://www.reddit.com/api/v1/authorize', + params: { + scope: 'identity', + duration: 'permanent', + response_type: 'code', }, - }, + }, + }), ] ``` From 6bd86be5271c1ab87568a93d411acc05c5f79d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Tue, 26 Jul 2022 10:42:30 +0200 Subject: [PATCH 3/3] Apply suggestions from code review --- docs/docs/providers/reddit.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/docs/providers/reddit.md b/docs/docs/providers/reddit.md index ad54577737..4c61b4d6a1 100644 --- a/docs/docs/providers/reddit.md +++ b/docs/docs/providers/reddit.md @@ -49,13 +49,9 @@ providers: [ RedditProvider({ clientId: process.env.REDDIT_CLIENT_ID, clientSecret: process.env.REDDIT_CLIENT_SECRET, - version: '2.0', authorization: { - url: 'https://www.reddit.com/api/v1/authorize', params: { - scope: 'identity', duration: 'permanent', - response_type: 'code', }, }, }),