Skip to content

Commit 633b76f

Browse files
k-taro56ndom91
andauthored
chore: Fix some documentation issues (#10980)
* chore: Fix some documentation issue * chore: Update imports to use named import for Auth in providers Co-authored-by: Nico Domino <[email protected]> --------- Co-authored-by: Nico Domino <[email protected]>
1 parent 63fd886 commit 633b76f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+602
-314
lines changed

packages/core/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ export async function Auth(
8686
*
8787
* @example
8888
* ```ts
89-
* import Auth from "@auth/core"
89+
* import { Auth } from "@auth/core"
9090
*
9191
* const request = new Request("https://example.com")
92-
* const response = await AuthHandler(request, {
92+
* const response = await Auth(request, {
9393
* providers: [Google],
9494
* secret: "...",
9595
* trustHost: true,

packages/core/src/providers/42-school.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,18 @@ export interface FortyTwoProfile extends UserData, Record<string, any> {
185185
* ```
186186
*
187187
* #### Configuration
188-
*```js
189-
* import Auth from "@auth/core"
190-
* import 42School from "@auth/core/providers/42-school"
188+
*```ts
189+
* import { Auth } from "@auth/core"
190+
* import FortyTwoSchool from "@auth/core/providers/42-school"
191191
*
192192
* const request = new Request(origin)
193193
* const response = await Auth(request, {
194-
* providers: [42School({ clientId: 42_SCHOOL_CLIENT_ID, clientSecret: 42_SCHOOL_CLIENT_SECRET })],
194+
* providers: [
195+
* FortyTwoSchool({
196+
* clientId: FORTY_TWO_SCHOOL_CLIENT_ID,
197+
* clientSecret: FORTY_TWO_SCHOOL_CLIENT_SECRET,
198+
* }),
199+
* ],
195200
* })
196201
* ```
197202
*

packages/core/src/providers/apple.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,16 @@ export interface AppleProfile extends Record<string, any> {
105105
* ```
106106
*
107107
* #### Configuration
108+
* ```ts
109+
* import { Auth } from "@auth/core"
110+
* import Apple from "@auth/core/providers/apple"
108111
*
109-
* Import the provider and configure it in your **Auth.js** initialization file:
110-
*
111-
* ```ts title="pages/api/auth/[...nextauth].ts"
112-
* import NextAuth from "next-auth"
113-
* import AppleProvider from "next-auth/providers/apple"
114-
*
115-
* export default NextAuth({
112+
* const request = new Request(origin)
113+
* const response = await Auth(request, {
116114
* providers: [
117-
* AppleProvider({
118-
* clientId: process.env.APPLE_ID,
119-
* clientSecret: process.env.APPLE_SECRET,
115+
* Apple({
116+
* clientId: APPLE_CLIENT_ID,
117+
* clientSecret: APPLE_CLIENT_SECRET,
120118
* }),
121119
* ],
122120
* })

packages/core/src/providers/asgardeo.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,19 @@ export interface AsgardeoProfile extends Record<string, any> {
4343
* ```
4444
*
4545
* #### Configuration
46-
*
47-
* Import the provider and configure it in your **Auth.js** initialization file:
48-
*
49-
* ```ts title="pages/api/auth/[...nextauth].ts"
50-
* import NextAuth from "next-auth"
51-
* import AsgardeoProvider from "next-auth/providers/asgardeo";
52-
*
53-
* export default NextAuth({
54-
* providers: [
55-
* AsgardeoProvider({
56-
* clientId: process.env.ASGARDEO_CLIENT_ID,
57-
* clientSecret: process.env.ASGARDEO_CLIENT_SECRET,
58-
* issuer: process.env.ASGARDEO_ISSUER
59-
* }),
60-
* ],
46+
*```ts
47+
* import { Auth } from "@auth/core"
48+
* import Asgarde from "@auth/core/providers/asgardeo";
49+
*
50+
* const request = new Request(origin)
51+
* const response = await Auth(request, {
52+
* providers: [
53+
* Asgardeo({
54+
* clientId: ASGARDEO_CLIENT_ID,
55+
* clientSecret: ASGARDEO_CLIENT_SECRET,
56+
* issuer: ASGARDEO_ISSUER,
57+
* }),
58+
* ],
6159
* })
6260
* ```
6361
*

packages/core/src/providers/auth0.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,16 @@ export interface Auth0Profile extends Record<string, any> {
8383
* ```
8484
*
8585
* #### Configuration
86+
* ```ts
87+
* import { Auth } from "@auth/core"
88+
* import Auth0 from "@auth/core/providers/auth0"
8689
*
87-
* Import the provider and configure it in your **Auth.js** initialization file:
88-
*
89-
* ```ts title="pages/api/auth/[...nextauth].ts"
90-
* import NextAuth from "next-auth"
91-
* import Auth0Provider from "next-auth/providers/auth0"
92-
*
93-
* export default NextAuth({
90+
* const request = new Request(origin)
91+
* const response = await Auth(request, {
9492
* providers: [
95-
* Auth0Provider({
96-
* clientId: process.env.AUTH0_ID,
97-
* clientSecret: process.env.AUTH0_SECRET,
93+
* Auth0({
94+
* clientId: AUTH0_ID,
95+
* clientSecret: AUTH0_SECRET,
9896
* }),
9997
* ],
10098
* })

packages/core/src/providers/authentik.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,19 @@ export interface AuthentikProfile extends Record<string, any> {
4242
* ```
4343
*
4444
* #### Configuration
45-
*```js
46-
* import Auth from "@auth/core"
45+
*```ts
46+
* import { Auth } from "@auth/core"
4747
* import Authentik from "@auth/core/providers/authentik"
4848
*
4949
* const request = new Request(origin)
5050
* const response = await Auth(request, {
51-
* providers: [Authentik({ clientId: AUTHENTIK_CLIENT_ID, clientSecret: AUTHENTIK_CLIENT_SECRET, issuer: AUTHENTIK_ISSUER })],
51+
* providers: [
52+
* Authentik({
53+
* clientId: AUTHENTIK_CLIENT_ID,
54+
* clientSecret: AUTHENTIK_CLIENT_SECRET,
55+
* issuer: AUTHENTIK_ISSUER,
56+
* }),
57+
* ],
5258
* })
5359
* ```
5460
*

packages/core/src/providers/azure-ad.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,18 @@ export interface AzureADProfile extends Record<string, any> {
3333
* ```
3434
*
3535
* #### Configuration
36-
*```js
37-
* import Auth from "@auth/core"
36+
*```ts
37+
* import { Auth } from "@auth/core"
3838
* import AzureAd from "@auth/core/providers/azure-ad"
3939
*
4040
* const request = new Request(origin)
4141
* const response = await Auth(request, {
42-
* providers: [AzureAd({ clientId: AZURE_AD_CLIENT_ID, clientSecret: AZURE_AD_CLIENT_SECRET })],
42+
* providers: [
43+
* AzureAd({
44+
* clientId: AZURE_AD_CLIENT_ID,
45+
* clientSecret: AZURE_AD_CLIENT_SECRET,
46+
* }),
47+
* ],
4348
* })
4449
* ```
4550
*
@@ -79,14 +84,14 @@ export interface AzureADProfile extends Record<string, any> {
7984
* Azure AD returns the profile picture in an ArrayBuffer, instead of just a URL to the image, so our provider converts it to a base64 encoded image string and returns that instead. See: https://docs.microsoft.com/en-us/graph/api/profilephoto-get?view=graph-rest-1.0#examples. The default image size is 48x48 to avoid [running out of space](https://next-auth.js.org/faq#:~:text=What%20are%20the%20disadvantages%20of%20JSON%20Web%20Tokens%3F) in case the session is saved as a JWT.
8085
* :::
8186
*
82-
* In `pages/api/auth/[...nextauth].js` find or add the `AzureAD` entries:
87+
* In `auth.ts` find or add the `AzureAD` entries:
8388
*
84-
* ```js
85-
* import AzureADProvider from "next-auth/providers/azure-ad";
89+
* ```ts
90+
* import AzureAd from "@auth/core/providers/azure-ad"
8691
*
8792
* ...
8893
* providers: [
89-
* AzureADProvider({
94+
* AzureAD({
9095
* clientId: process.env.AZURE_AD_CLIENT_ID,
9196
* clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
9297
* tenantId: process.env.AZURE_AD_TENANT_ID,

packages/core/src/providers/azure-devops.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ export interface AzureDevOpsProfile extends Record<string, any> {
6464
*
6565
* ## Example
6666
*
67-
* ```js title="pages/api/auth/[...nextauth].js"
68-
* import AzureDevOpsProvider from "next-auth/providers/azure-devops"
67+
* ```ts
68+
* import AzureDevOps from "@auth/core/providers/azure-devops"
6969
* ...
7070
* providers: [
71-
* AzureDevOpsProvider({
71+
* AzureDevOps({
7272
* clientId: process.env.AZURE_DEVOPS_APP_ID,
7373
* clientSecret: process.env.AZURE_DEVOPS_CLIENT_SECRET,
7474
* scope: process.env.AZURE_DEVOPS_SCOPE,
@@ -81,7 +81,7 @@ export interface AzureDevOpsProfile extends Record<string, any> {
8181
*
8282
* Use the [main guide](/guides/basics/refresh-token-rotation) as your starting point with the following considerations:
8383
*
84-
* ```js title="pages/api/auth/[...nextauth].js"
84+
* ```ts
8585
* async jwt({ token, user, account }) {
8686
* ...
8787
* // The token has an absolute expiration time
@@ -99,7 +99,7 @@ export interface AzureDevOpsProfile extends Record<string, any> {
9999
* body: new URLSearchParams({
100100
* client_assertion_type:
101101
* "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
102-
* client_assertion: AZURE_DEVOPS_CLIENT_SECRET,
102+
* client_assertion: process.env.AZURE_DEVOPS_CLIENT_SECRET,
103103
* grant_type: "refresh_token",
104104
* assertion: token.refreshToken,
105105
* redirect_uri:

packages/core/src/providers/battlenet.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ export type BattleNetIssuer =
3333
* ```
3434
*
3535
* #### Configuration
36-
*```js
37-
* import Auth from "@auth/core"
36+
*```ts
37+
* import { Auth } from "@auth/core"
3838
* import BattleNet from "@auth/core/providers/battlenet"
3939
*
4040
* const request = new Request(origin)
4141
* const response = await Auth(request, {
42-
* providers: [BattleNet({ clientId: BATTLENET_CLIENT_ID, clientSecret: BATTLENET_CLIENT_SECRET. issuer: BATTLENET_ISSUER })],
42+
* providers: [
43+
* BattleNet({
44+
* clientId: BATTLENET_CLIENT_ID,
45+
* clientSecret: BATTLENET_CLIENT_SECRET,
46+
* issuer: BATTLENET_ISSUER,
47+
* }),
48+
* ],
4349
* })
4450
* ```
4551
* issuer must be one of these values, based on the available regions:

packages/core/src/providers/beyondidentity.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,34 @@ export interface BeyondIdentityProfile {
2626
/**
2727
* Add Beyond Identity login to your page.
2828
*
29-
* @example
29+
* ### Setup
3030
*
31+
* #### Callback URL
32+
* ```
33+
* https://example.com/api/auth/callback/beyondidentity
34+
* ```
35+
*
36+
* #### Configuration
3137
* ```ts
3238
* import { Auth } from "@auth/core"
3339
* import BeyondIdentity from "@auth/core/providers/beyondidentity"
3440
*
3541
* const request = new Request(origin)
3642
* const response = await Auth(request, {
37-
* providers: [BeyondIdentity({ clientId: BEYOND_IDENTITY_CLIENT_ID, clientSecret: BEYOND_IDENTITY_CLIENT_SECRET, issuer: BEYOND_IDENTITY_ISSUER })],
43+
* providers: [
44+
* BeyondIdentity({
45+
* clientId: BEYOND_IDENTITY_CLIENT_ID,
46+
* clientSecret: BEYOND_IDENTITY_CLIENT_SECRET,
47+
* issuer: BEYOND_IDENTITY_ISSUER,
48+
* }),
49+
* ],
3850
* })
3951
* ```
4052
*
41-
* ---
42-
*
4353
* ### Resources
4454
*
4555
* - [Beyond Identity Developer Docs](https://developer.beyondidentity.com/)
4656
*
47-
* ---
48-
*
4957
* ### Notes
5058
*
5159
* By default, Auth.js assumes that the BeyondIdentity provider is

0 commit comments

Comments
 (0)