Skip to content

Commit

Permalink
feat(provider): Add Medium (#1213)
Browse files Browse the repository at this point in the history
  • Loading branch information
defvova authored and balazsorban44 committed Feb 1, 2021
1 parent f4a954c commit ad3b0b6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/providers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import IdentityServer4 from './identity-server4'
import LINE from './line'
import LinkedIn from './linkedin'
import MailRu from './mailru'
import Medium from './medium'
import Netlify from './netlify'
import Okta from './okta'
import Reddit from './reddit'
Expand Down Expand Up @@ -55,6 +56,7 @@ export default {
LINE,
LinkedIn,
MailRu,
Medium,
Netlify,
Okta,
Reddit,
Expand Down
22 changes: 22 additions & 0 deletions src/providers/medium.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export default (options) => {
return {
id: 'medium',
name: 'Medium',
type: 'oauth',
version: '2.0',
scope: 'basicProfile',
params: { grant_type: 'authorization_code' },
accessTokenUrl: 'https://api.medium.com/v1/tokens',
authorizationUrl: 'https://medium.com/m/oauth/authorize?response_type=code',
profileUrl: 'https://api.medium.com/v1/me',
profile: (profile) => {
return {
id: profile.data.id,
name: profile.data.name,
email: null,
image: profile.data.imageUrl
}
},
...options
}
}
30 changes: 30 additions & 0 deletions www/docs/providers/medium.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
id: medium
title: Medium
---

## Documentation

https://github.com/Medium/medium-api-docs

## Configuration

https://medium.com/me/applications

## Example

```js
import Providers from `next-auth/providers`
...
providers: [
Providers.Medium({
clientId: process.env.MEDIUM_CLIENT_ID,
clientSecret: process.env.MEDIUM_CLIENT_SECRET
})
}
...
```

:::warning
Email address is not returned by the Medium API.
:::
1 change: 1 addition & 0 deletions www/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"line": "LINE",
"linkedin": "LinkedIn",
"mailru": "Mail.ru",
"medium": "Medium",
"netlify": "Netlify",
"okta": "Okta",
"reddit": "Reddit",
Expand Down

0 comments on commit ad3b0b6

Please sign in to comment.