Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(provider): Add medium #1213

Merged
merged 1 commit into from
Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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