mirror of
https://github.com/SrIzan10/next-auth.git
synced 2026-05-01 10:55:20 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb04ab4e76 | ||
|
|
07e2a83ccb | ||
|
|
065d9eb310 | ||
|
|
5da19f3c9a | ||
|
|
88ec3bad71 | ||
|
|
5ab7868533 | ||
|
|
835dda0899 | ||
|
|
ad4709764a | ||
|
|
55a2932973 |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/types/ @balazsorban44 @lluia
|
||||
0
FUNDING.yml → .github/FUNDING.yml
vendored
0
FUNDING.yml → .github/FUNDING.yml
vendored
18
.github/workflows/build.yml
vendored
18
.github/workflows/build.yml
vendored
@@ -4,22 +4,22 @@ name: Lint/Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- beta
|
||||
- next
|
||||
branches:
|
||||
- main
|
||||
- beta
|
||||
- next
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- beta
|
||||
- next
|
||||
- main
|
||||
- beta
|
||||
- next
|
||||
|
||||
jobs:
|
||||
lint-and-build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10, 12, 14]
|
||||
node-version: [12, 14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
@@ -29,4 +29,4 @@ jobs:
|
||||
- name: Install dependencies
|
||||
uses: bahmutov/npm-install@v1
|
||||
- run: npm run lint
|
||||
- run: npm run build
|
||||
- run: npm run build
|
||||
|
||||
2
.github/workflows/integration.yml
vendored
2
.github/workflows/integration.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10, 12, 14]
|
||||
node-version: [12, 14, 16]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
2
.github/workflows/types.yml
vendored
2
.github/workflows/types.yml
vendored
@@ -19,6 +19,8 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 14
|
||||
- name: Install dependencies
|
||||
uses: bahmutov/npm-install@v1
|
||||
- name: Check types
|
||||
|
||||
12
package.json
12
package.json
@@ -180,6 +180,18 @@
|
||||
"name": "next",
|
||||
"prerelease": true
|
||||
}
|
||||
],
|
||||
"plugins": [
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator",
|
||||
"@semantic-release/npm",
|
||||
[
|
||||
"@semantic-release/github",
|
||||
{
|
||||
"releasedLabels": false,
|
||||
"successComment": false
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"funding": [
|
||||
|
||||
23
src/providers/wordpress.js
Normal file
23
src/providers/wordpress.js
Normal file
@@ -0,0 +1,23 @@
|
||||
export default function WordPress(options) {
|
||||
return {
|
||||
id: "wordpress",
|
||||
name: "WordPress.com",
|
||||
type: "oauth",
|
||||
version: "2.0",
|
||||
scope: "auth",
|
||||
params: { grant_type: "authorization_code" },
|
||||
accessTokenUrl: "https://public-api.wordpress.com/oauth2/token",
|
||||
authorizationUrl:
|
||||
"https://public-api.wordpress.com/oauth2/authorize?response_type=code",
|
||||
profileUrl: "https://public-api.wordpress.com/rest/v1/me",
|
||||
profile(profile) {
|
||||
return {
|
||||
id: profile.ID,
|
||||
name: profile.display_name,
|
||||
email: profile.email,
|
||||
image: profile.avatar_URL,
|
||||
}
|
||||
},
|
||||
...options,
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
# Rename file to .env and populate values
|
||||
# to be able to run tests
|
||||
# To be able to run tests:
|
||||
# 1. copy to the root folder and rename to .env
|
||||
# 2. Populate with values
|
||||
NEXTAUTH_URL=http://localhost:3000
|
||||
NEXTAUTH_TWITTER_ID=
|
||||
NEXTAUTH_TWITTER_SECRET=
|
||||
@@ -2,14 +2,13 @@
|
||||
#
|
||||
# Note: Uses Docker Compose v2 as v3 doesn't currently support extends.
|
||||
# https://docs.docker.com/compose/compose-file/compose-file-v2/
|
||||
version: '2.3'
|
||||
version: "2.3"
|
||||
|
||||
services:
|
||||
|
||||
app:
|
||||
build:
|
||||
context: ../../
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: ./test/Dockerfile
|
||||
environment:
|
||||
# Set env vars in your current terminal or in .env in the root directory
|
||||
- NEXTAUTH_URL=${NEXTAUTH_URL}
|
||||
|
||||
4
types/client.d.ts
vendored
4
types/client.d.ts
vendored
@@ -32,7 +32,7 @@ export function useSession(): [Session | null, boolean]
|
||||
*
|
||||
* [Documentation](https://next-auth.js.org/getting-started/client#getsession)
|
||||
*/
|
||||
export function getSession(options: GetSessionOptions): Promise<Session | null>
|
||||
export function getSession(options?: GetSessionOptions): Promise<Session | null>
|
||||
|
||||
/**
|
||||
* Alias for `getSession`
|
||||
@@ -52,7 +52,7 @@ export const session: typeof getSession
|
||||
*
|
||||
* [Documentation](https://next-auth.js.org/getting-started/client#getcsrftoken)
|
||||
*/
|
||||
export function getCsrfToken(ctxOrReq: CtxOrReq): Promise<string | null>
|
||||
export function getCsrfToken(ctxOrReq?: CtxOrReq): Promise<string | null>
|
||||
|
||||
/**
|
||||
* Alias for `getCsrfToken`
|
||||
|
||||
2
types/providers.d.ts
vendored
2
types/providers.d.ts
vendored
@@ -77,6 +77,7 @@ export type OAuthProviderType =
|
||||
| "Kakao"
|
||||
| "LINE"
|
||||
| "LinkedIn"
|
||||
| "Mailchimp"
|
||||
| "MailRu"
|
||||
| "Medium"
|
||||
| "Netlify"
|
||||
@@ -90,6 +91,7 @@ export type OAuthProviderType =
|
||||
| "Twitch"
|
||||
| "Twitter"
|
||||
| "VK"
|
||||
| "WordPress"
|
||||
| "Yandex"
|
||||
| "Zoho"
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ By default, the built-in pages will follow the system theme, utilizing the [`pre
|
||||
In order to get the available authentication providers and the URLs to use for them, you can make a request to the API endpoint `/api/auth/providers`:
|
||||
|
||||
```jsx title="pages/auth/signin.js"
|
||||
import { providers, signIn } from 'next-auth/client'
|
||||
import { getProviders, signIn } from 'next-auth/client'
|
||||
|
||||
export default function SignIn({ providers }) {
|
||||
return (
|
||||
@@ -76,7 +76,7 @@ export default function SignIn({ providers }) {
|
||||
|
||||
// This is the recommended way for Next.js 9.3 or newer
|
||||
export async function getServerSideProps(context){
|
||||
const providers = await providers()
|
||||
const providers = await getProviders()
|
||||
return {
|
||||
props: { providers }
|
||||
}
|
||||
@@ -86,7 +86,7 @@ export async function getServerSideProps(context){
|
||||
// If older than Next.js 9.3
|
||||
SignIn.getInitialProps = async () => {
|
||||
return {
|
||||
providers: await providers()
|
||||
providers: await getProviders()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
30
www/docs/providers/wordpress.md
Normal file
30
www/docs/providers/wordpress.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
id: wordpress
|
||||
title: WordPress.com
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
https://developer.wordpress.com/docs/oauth2/
|
||||
|
||||
## Configuration
|
||||
|
||||
https://developer.wordpress.com/apps/
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
import Providers from `next-auth/providers`
|
||||
...
|
||||
providers: [
|
||||
Providers.WordPress({
|
||||
clientId: process.env.WORDPRESS_CLIENT_ID,
|
||||
clientSecret: process.env.WORDPRESS_CLIENT_SECRET
|
||||
})
|
||||
}
|
||||
...
|
||||
```
|
||||
|
||||
:::tip
|
||||
Register your application to obtain Client ID and Client Secret at https://developer.wordpress.com/apps/ Select Type as Web and set Redirect URL to `http://example.com/api/auth/callback/wordpress` where example.com is your site domain.
|
||||
:::
|
||||
Reference in New Issue
Block a user