Skip to content

Commit ad3b0b6

Browse files
defvovabalazsorban44
authored andcommitted
feat(provider): Add Medium (#1213)
1 parent f4a954c commit ad3b0b6

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

src/providers/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import IdentityServer4 from './identity-server4'
2020
import LINE from './line'
2121
import LinkedIn from './linkedin'
2222
import MailRu from './mailru'
23+
import Medium from './medium'
2324
import Netlify from './netlify'
2425
import Okta from './okta'
2526
import Reddit from './reddit'
@@ -55,6 +56,7 @@ export default {
5556
LINE,
5657
LinkedIn,
5758
MailRu,
59+
Medium,
5860
Netlify,
5961
Okta,
6062
Reddit,

src/providers/medium.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export default (options) => {
2+
return {
3+
id: 'medium',
4+
name: 'Medium',
5+
type: 'oauth',
6+
version: '2.0',
7+
scope: 'basicProfile',
8+
params: { grant_type: 'authorization_code' },
9+
accessTokenUrl: 'https://api.medium.com/v1/tokens',
10+
authorizationUrl: 'https://medium.com/m/oauth/authorize?response_type=code',
11+
profileUrl: 'https://api.medium.com/v1/me',
12+
profile: (profile) => {
13+
return {
14+
id: profile.data.id,
15+
name: profile.data.name,
16+
email: null,
17+
image: profile.data.imageUrl
18+
}
19+
},
20+
...options
21+
}
22+
}

www/docs/providers/medium.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
id: medium
3+
title: Medium
4+
---
5+
6+
## Documentation
7+
8+
https://github.com/Medium/medium-api-docs
9+
10+
## Configuration
11+
12+
https://medium.com/me/applications
13+
14+
## Example
15+
16+
```js
17+
import Providers from `next-auth/providers`
18+
...
19+
providers: [
20+
Providers.Medium({
21+
clientId: process.env.MEDIUM_CLIENT_ID,
22+
clientSecret: process.env.MEDIUM_CLIENT_SECRET
23+
})
24+
}
25+
...
26+
```
27+
28+
:::warning
29+
Email address is not returned by the Medium API.
30+
:::

www/providers.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"line": "LINE",
2222
"linkedin": "LinkedIn",
2323
"mailru": "Mail.ru",
24+
"medium": "Medium",
2425
"netlify": "Netlify",
2526
"okta": "Okta",
2627
"reddit": "Reddit",

0 commit comments

Comments
 (0)