Skip to content

Commit

Permalink
chore: define providers in single file for docs [skip release]
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Jan 12, 2021
1 parent ecbaa14 commit 1a1a1f9
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 67 deletions.
39 changes: 8 additions & 31 deletions www/docs/configuration/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,14 @@ NextAuth.js is designed to work with any OAuth service, it supports OAuth 1.0, 1

### Built-in OAuth providers

* [Apple](/providers/apple)
* [Atlassian](/providers/atlassian)
* [Auth0](/providers/auth0)
* [Azure Active Directory B2C](/providers/azure-ad-b2c)
* [Basecamp](/providers/basecamp)
* [Battle.net](/providers/battle.net)
* [Box](/providers/box)
* [Bungie](/providers/bungie)
* [Amazon Cognito](/providers/cognito)
* [Discord](/providers/discord)
* [Facebook](/providers/facebook)
* [Foursquare](/providers/foursquare)
* [FusionAuth](/providers/fusionauth)
* [GitHub](/providers/github)
* [GitLab](/providers/gitlab)
* [Google](/providers/google)
* [IdentityServer4](/providers/identity-server4)
* [LINE](/providers/line)
* [LinkedIn](/providers/linkedin)
* [Mail.ru](/providers/mailru)
* [Mixer](/providers/mixer)
* [Netlify](/providers/netlify)
* [Okta](/providers/okta)
* [Reddit](/providers/reddit)
* [Slack](/providers/slack)
* [Spotify](/providers/spotify)
* [Strava](/providers/strava)
* [Twitch](/providers/Twitch)
* [Twitter](/providers/twitter)
* [VK](/providers/vk)
* [Yandex](/providers/yandex)
<ul>
{Object.entries(require("../../providers.json"))

This comment has been minimized.

Copy link
@ndom91

ndom91 Jan 18, 2021

Member

@balazsorban44 hahah fantastic idea!

This comment has been minimized.

Copy link
@balazsorban44

balazsorban44 Jan 19, 2021

Author Member

I think we can even generate www/providers.json by going over the files in www/docs/providers and get the id and title from the front matter. We could add this as a pre-build step for the docs.

(Update, created a good first issue for this #1157 😅)

.filter(([key]) => !["email", "credentials"].includes(key))
.sort(([, a], [, b]) => a.localeCompare(b))
.map(([key, name]) =>
<li key={key}><a href={`/providers/${key}`}>{name}</a></li>
)}
</ul>

### Using a built-in OAuth provider

Expand Down
7 changes: 6 additions & 1 deletion www/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ You can use also NextAuth.js with any database using a custom database adapter,

### What authentication services does NextAuth.js support?

NextAuth.js includes built-in support for signing in with Amazon Cognito, Apple, Atlassian, Auth0, Azure Active Directory B2C, Basecamp, Battle.net, Box, Bungie, Discord, Facebook, Foursquare, FusionAuth, GitHub, GitLab, Google, IdentityServer4, LINE, LinkedIn, Mail.ru, Mixer, Netlify, Okta, Reddit, Slack, Spotify, Strava, Twitch, Twitter, VK and Yandex. (See also: [Providers](/configuration/providers))

<p>NextAuth.js includes built-in support for signing in with&nbsp;
{Object.values(require("../providers.json")).sort().join(", ")}.
(See also: <a href="/configuration/providers">Providers</a>)
</p>


NextAuth.js also supports email for passwordless sign in, which is useful for account recovery or for people who are not able to use an account with the configured OAuth services (e.g. due to service outage, account suspension or otherwise becoming locked out of an account).

Expand Down
35 changes: 35 additions & 0 deletions www/providers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"apple": "Apple",
"atlassian": "Atlassian",
"auth0": "Auth0",
"azure-ad-b2c": "Azure Active Directory B2C",
"basecamp": "Basecamp",
"battle.net": "Battle.net",
"box": "Box",
"bungie": "Bungie",
"cognito": "Amazon Cognito",
"credentials": "Credentials",
"discord": "Discord",
"email": "Email",
"facebook": "Facebook",
"foursquare": "Foursquare",
"fusionauth": "FusionAuth",
"github": "GitHub",
"gitlab": "GitLab",
"google": "Google",
"identity-server4": "IdentityServer4",
"line": "LINE",
"linkedin": "LinkedIn",
"mailru": "Mail.ru",
"mixer": "Mixer",
"netlify": "Netlify",
"okta": "Okta",
"reddit": "Reddit",
"slack": "Slack",
"spotify": "Spotify",
"strava": "Strava",
"twitch": "Twitch",
"twitter": "Twitter",
"vk": "VK",
"yandex": "Yandex"
}
39 changes: 4 additions & 35 deletions www/sidebars.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const providers = require('./providers.json')
module.exports = {
sidebar: {
'Getting Started': [
Expand All @@ -23,40 +24,8 @@ module.exports = {
'schemas/mongodb',
'schemas/adapters'
],
'Authentication Providers': [
'providers/apple',
'providers/atlassian',
'providers/auth0',
'providers/azure-ad-b2c',
'providers/basecamp',
'providers/battle.net',
'providers/box',
'providers/bungie',
'providers/cognito',
'providers/discord',
'providers/email',
'providers/credentials',
'providers/facebook',
'providers/foursquare',
'providers/fusionauth',
'providers/github',
'providers/gitlab',
'providers/google',
'providers/identity-server4',
'providers/line',
'providers/linkedin',
'providers/mailru',
'providers/mixer',
'providers/netlify',
'providers/okta',
'providers/reddit',
'providers/slack',
'providers/spotify',
'providers/strava',
'providers/twitch',
'providers/twitter',
'providers/vk',
'providers/yandex'
]
'Authentication Providers': Object.entries(providers)
.sort(([, a], [, b]) => a.localeCompare(b))
.map(([provider]) => `providers/${provider}`)
}
}

1 comment on commit 1a1a1f9

@ndom91
Copy link
Member

@ndom91 ndom91 commented on 1a1a1f9 Jan 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entire PR gets two thumbs up 👍 👍

Please sign in to comment.