Skip to content

Commit

Permalink
chore: Fix some documentation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
k-taro56 committed May 20, 2024
1 parent 7770f2b commit 8db6a54
Show file tree
Hide file tree
Showing 81 changed files with 546 additions and 258 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* ## Usage
*
* ```ts
* import { Auth } from "@auth/core"
* import Auth from "@auth/core"
*
* const request = new Request("https://example.com")
* const response = await Auth(request, {...})
Expand Down Expand Up @@ -89,7 +89,7 @@ export async function Auth(
* import Auth from "@auth/core"
*
* const request = new Request("https://example.com")
* const response = await AuthHandler(request, {
* const response = await Auth(request, {
* providers: [Google],
* secret: "...",
* trustHost: true,
Expand Down
11 changes: 8 additions & 3 deletions packages/core/src/providers/42-school.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,18 @@ export interface FortyTwoProfile extends UserData, Record<string, any> {
* ```
*
* #### Configuration
*```js
*```ts

Check warning on line 188 in packages/core/src/providers/42-school.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L188 was not covered by tests
* import Auth from "@auth/core"
* import 42School from "@auth/core/providers/42-school"
* import FortyTwoSchool from "@auth/core/providers/42-school"

Check warning on line 190 in packages/core/src/providers/42-school.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L190 was not covered by tests
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [42School({ clientId: 42_SCHOOL_CLIENT_ID, clientSecret: 42_SCHOOL_CLIENT_SECRET })],
* providers: [
* FortyTwoSchool({
* clientId: FORTY_TWO_SCHOOL_CLIENT_ID,
* clientSecret: FORTY_TWO_SCHOOL_CLIENT_SECRET,
* }),
* ],

Check warning on line 199 in packages/core/src/providers/42-school.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/42-school.ts#L194-L199

Added lines #L194 - L199 were not covered by tests
* })
* ```
*
Expand Down
18 changes: 8 additions & 10 deletions packages/core/src/providers/apple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,16 @@ export interface AppleProfile extends Record<string, any> {
* ```
*
* #### Configuration
* ```ts
* import Auth from "@auth/core"
* import Apple from "@auth/core/providers/apple"

Check warning on line 110 in packages/core/src/providers/apple.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/apple.ts#L108-L110

Added lines #L108 - L110 were not covered by tests
*
* Import the provider and configure it in your **Auth.js** initialization file:
*
* ```ts title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import AppleProvider from "next-auth/providers/apple"
*
* export default NextAuth({
* const request = new Request(origin)
* const response = await Auth(request, {

Check warning on line 113 in packages/core/src/providers/apple.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/apple.ts#L112-L113

Added lines #L112 - L113 were not covered by tests
* providers: [
* AppleProvider({
* clientId: process.env.APPLE_ID,
* clientSecret: process.env.APPLE_SECRET,
* Apple({
* clientId: APPLE_CLIENT_ID,
* clientSecret: APPLE_CLIENT_SECRET,

Check warning on line 117 in packages/core/src/providers/apple.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/apple.ts#L115-L117

Added lines #L115 - L117 were not covered by tests
* }),
* ],
* })
Expand Down
28 changes: 13 additions & 15 deletions packages/core/src/providers/asgardeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,19 @@ export interface AsgardeoProfile extends Record<string, any> {
* ```
*
* #### Configuration
*
* Import the provider and configure it in your **Auth.js** initialization file:
*
* ```ts title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import AsgardeoProvider from "next-auth/providers/asgardeo";
*
* export default NextAuth({
* providers: [
* AsgardeoProvider({
* clientId: process.env.ASGARDEO_CLIENT_ID,
* clientSecret: process.env.ASGARDEO_CLIENT_SECRET,
* issuer: process.env.ASGARDEO_ISSUER
* }),
* ],
*```ts
* import Auth from "@auth/core"
* import Asgarde from "@auth/core/providers/asgardeo";
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [
* Asgardeo({
* clientId: ASGARDEO_CLIENT_ID,
* clientSecret: ASGARDEO_CLIENT_SECRET,
* issuer: ASGARDEO_ISSUER,
* }),
* ],

Check warning on line 58 in packages/core/src/providers/asgardeo.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/asgardeo.ts#L46-L58

Added lines #L46 - L58 were not covered by tests
* })
* ```
*
Expand Down
18 changes: 8 additions & 10 deletions packages/core/src/providers/auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,16 @@ export interface Auth0Profile extends Record<string, any> {
* ```
*
* #### Configuration
* ```ts
* import Auth from "@auth/core"
* import Auth0 from "@auth/core/providers/auth0"
*
* Import the provider and configure it in your **Auth.js** initialization file:
*
* ```ts title="pages/api/auth/[...nextauth].ts"
* import NextAuth from "next-auth"
* import Auth0Provider from "next-auth/providers/auth0"
*
* export default NextAuth({
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [
* Auth0Provider({
* clientId: process.env.AUTH0_ID,
* clientSecret: process.env.AUTH0_SECRET,
* Auth0({
* clientId: AUTH0_ID,
* clientSecret: AUTH0_SECRET,
* }),
* ],
* })
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/providers/authentik.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,19 @@ export interface AuthentikProfile extends Record<string, any> {
* ```
*
* #### Configuration
*```js
*```ts

Check warning on line 45 in packages/core/src/providers/authentik.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/authentik.ts#L45

Added line #L45 was not covered by tests
* import Auth from "@auth/core"
* import Authentik from "@auth/core/providers/authentik"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [Authentik({ clientId: AUTHENTIK_CLIENT_ID, clientSecret: AUTHENTIK_CLIENT_SECRET, issuer: AUTHENTIK_ISSUER })],
* providers: [
* Authentik({
* clientId: AUTHENTIK_CLIENT_ID,
* clientSecret: AUTHENTIK_CLIENT_SECRET,
* issuer: AUTHENTIK_ISSUER,
* }),
* ],

Check warning on line 57 in packages/core/src/providers/authentik.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/authentik.ts#L51-L57

Added lines #L51 - L57 were not covered by tests
* })
* ```
*
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/providers/azure-ad-b2c.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface AzureADB2CProfile {
* @example
*
* ```ts
* import { Auth } from "@auth/core"
* import Auth from "@auth/core"

Check warning on line 65 in packages/core/src/providers/azure-ad-b2c.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/azure-ad-b2c.ts#L65

Added line #L65 was not covered by tests
* import AzureADB2C from "@auth/core/providers/azure-ad-b2c"
*
* const request = new Request("https://example.com")
Expand Down
17 changes: 11 additions & 6 deletions packages/core/src/providers/azure-ad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ export interface AzureADProfile extends Record<string, any> {
* ```
*
* #### Configuration
*```js
*```ts

Check warning on line 36 in packages/core/src/providers/azure-ad.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L36 was not covered by tests
* import Auth from "@auth/core"
* import AzureAd from "@auth/core/providers/azure-ad"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [AzureAd({ clientId: AZURE_AD_CLIENT_ID, clientSecret: AZURE_AD_CLIENT_SECRET })],
* providers: [
* AzureAd({
* clientId: AZURE_AD_CLIENT_ID,
* clientSecret: AZURE_AD_CLIENT_SECRET,
* }),
* ],

Check warning on line 47 in packages/core/src/providers/azure-ad.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/azure-ad.ts#L42-L47

Added lines #L42 - L47 were not covered by tests
* })
* ```
*
Expand Down Expand Up @@ -79,14 +84,14 @@ export interface AzureADProfile extends Record<string, any> {
* 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.
* :::
*
* In `pages/api/auth/[...nextauth].js` find or add the `AzureAD` entries:
* In `auth.ts` find or add the `AzureAD` entries:

Check warning on line 87 in packages/core/src/providers/azure-ad.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L87 was not covered by tests
*
* ```js
* import AzureADProvider from "next-auth/providers/azure-ad";
* ```ts
* import AzureAd from "@auth/core/providers/azure-ad"

Check warning on line 90 in packages/core/src/providers/azure-ad.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/azure-ad.ts#L89-L90

Added lines #L89 - L90 were not covered by tests
*
* ...
* providers: [
* AzureADProvider({
* AzureAD({

Check warning on line 94 in packages/core/src/providers/azure-ad.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L94 was not covered by tests
* clientId: process.env.AZURE_AD_CLIENT_ID,
* clientSecret: process.env.AZURE_AD_CLIENT_SECRET,
* tenantId: process.env.AZURE_AD_TENANT_ID,
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/providers/azure-devops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ export interface AzureDevOpsProfile extends Record<string, any> {
*
* ## Example
*
* ```js title="pages/api/auth/[...nextauth].js"
* import AzureDevOpsProvider from "next-auth/providers/azure-devops"
* ```ts
* import AzureDevOps from "@auth/core/providers/azure-devops"

Check warning on line 68 in packages/core/src/providers/azure-devops.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/azure-devops.ts#L67-L68

Added lines #L67 - L68 were not covered by tests
* ...
* providers: [
* AzureDevOpsProvider({
* AzureDevOps({

Check warning on line 71 in packages/core/src/providers/azure-devops.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L71 was not covered by tests
* clientId: process.env.AZURE_DEVOPS_APP_ID,
* clientSecret: process.env.AZURE_DEVOPS_CLIENT_SECRET,
* scope: process.env.AZURE_DEVOPS_SCOPE,
Expand All @@ -81,7 +81,7 @@ export interface AzureDevOpsProfile extends Record<string, any> {
*
* Use the [main guide](/guides/basics/refresh-token-rotation) as your starting point with the following considerations:
*
* ```js title="pages/api/auth/[...nextauth].js"
* ```ts

Check warning on line 84 in packages/core/src/providers/azure-devops.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L84 was not covered by tests
* async jwt({ token, user, account }) {
* ...
* // The token has an absolute expiration time
Expand All @@ -99,7 +99,7 @@ export interface AzureDevOpsProfile extends Record<string, any> {
* body: new URLSearchParams({
* client_assertion_type:
* "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
* client_assertion: AZURE_DEVOPS_CLIENT_SECRET,
* client_assertion: process.env.AZURE_DEVOPS_CLIENT_SECRET,

Check warning on line 102 in packages/core/src/providers/azure-devops.ts

View check run for this annotation

Codecov / codecov/patch

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

Added line #L102 was not covered by tests
* grant_type: "refresh_token",
* assertion: token.refreshToken,
* redirect_uri:
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/providers/battlenet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ export type BattleNetIssuer =
* ```
*
* #### Configuration
*```js
*```ts

Check warning on line 36 in packages/core/src/providers/battlenet.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/battlenet.ts#L36

Added line #L36 was not covered by tests
* import Auth from "@auth/core"
* import BattleNet from "@auth/core/providers/battlenet"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [BattleNet({ clientId: BATTLENET_CLIENT_ID, clientSecret: BATTLENET_CLIENT_SECRET. issuer: BATTLENET_ISSUER })],
* providers: [
* BattleNet({
* clientId: BATTLENET_CLIENT_ID,
* clientSecret: BATTLENET_CLIENT_SECRET,
* issuer: BATTLENET_ISSUER,
* }),
* ],

Check warning on line 48 in packages/core/src/providers/battlenet.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/battlenet.ts#L42-L48

Added lines #L42 - L48 were not covered by tests
* })
* ```
* issuer must be one of these values, based on the available regions:
Expand Down
22 changes: 15 additions & 7 deletions packages/core/src/providers/beyondidentity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,34 @@ export interface BeyondIdentityProfile {
/**
* Add Beyond Identity login to your page.
*
* @example
* ### Setup

Check warning on line 29 in packages/core/src/providers/beyondidentity.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/beyondidentity.ts#L29

Added line #L29 was not covered by tests
*
* #### Callback URL
* ```
* https://example.com/api/auth/callback/beyondidentity
* ```
*
* #### Configuration

Check warning on line 36 in packages/core/src/providers/beyondidentity.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/beyondidentity.ts#L31-L36

Added lines #L31 - L36 were not covered by tests
* ```ts
* import { Auth } from "@auth/core"
* import Auth from "@auth/core"

Check warning on line 38 in packages/core/src/providers/beyondidentity.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/beyondidentity.ts#L38

Added line #L38 was not covered by tests
* import BeyondIdentity from "@auth/core/providers/beyondidentity"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [BeyondIdentity({ clientId: BEYOND_IDENTITY_CLIENT_ID, clientSecret: BEYOND_IDENTITY_CLIENT_SECRET, issuer: BEYOND_IDENTITY_ISSUER })],
* providers: [
* BeyondIdentity({
* clientId: BEYOND_IDENTITY_CLIENT_ID,
* clientSecret: BEYOND_IDENTITY_CLIENT_SECRET,
* issuer: BEYOND_IDENTITY_ISSUER,
* }),
* ],

Check warning on line 49 in packages/core/src/providers/beyondidentity.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/beyondidentity.ts#L43-L49

Added lines #L43 - L49 were not covered by tests
* })
* ```
*
* ---
*
* ### Resources
*
* - [Beyond Identity Developer Docs](https://developer.beyondidentity.com/)
*
* ---
*
* ### Notes
*
* By default, Auth.js assumes that the BeyondIdentity provider is
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/providers/box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js"
* ```
*
* #### Configuration
*```js
*```ts

Check warning on line 24 in packages/core/src/providers/box.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/box.ts#L24

Added line #L24 was not covered by tests
* import Auth from "@auth/core"
* import Box from "@auth/core/providers/box"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [Box({ clientId: BOX_CLIENT_ID, clientSecret: BOX_CLIENT_SECRET })],
* providers: [
* Box({ clientId: BOX_CLIENT_ID, clientSecret: BOX_CLIENT_SECRET }),
* ],

Check warning on line 32 in packages/core/src/providers/box.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/box.ts#L30-L32

Added lines #L30 - L32 were not covered by tests
* })
* ```
*
Expand Down
32 changes: 18 additions & 14 deletions packages/core/src/providers/boxyhq-saml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,37 @@ export interface BoxyHQSAMLProfile extends Record<string, any> {
* #### Configuration
*
* For OAuth 2.0 Flow:
*```js
*```ts

Check warning on line 37 in packages/core/src/providers/boxyhq-saml.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/boxyhq-saml.ts#L37

Added line #L37 was not covered by tests
* import Auth from "@auth/core"
* import BoxyHQ from "@auth/core/providers/boxyhq-saml"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [BoxyHQ({
* authorization: { params: { scope: "" } }, // This is needed for OAuth 2.0 flow, otherwise default to openid
* clientId: BOXYHQ_SAML_CLIENT_ID,
* clientSecret: BOXYHQ_SAML_CLIENT_SECRET,
* issuer: BOXYHQ_SAML_ISSUER
* })],
* providers: [
* BoxyHQ({
* authorization: { params: { scope: "" } }, // This is needed for OAuth 2.0 flow, otherwise default to openid
* clientId: BOXYHQ_SAML_CLIENT_ID,
* clientSecret: BOXYHQ_SAML_CLIENT_SECRET,
* issuer: BOXYHQ_SAML_ISSUER,
* }),
* ],

Check warning on line 50 in packages/core/src/providers/boxyhq-saml.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/boxyhq-saml.ts#L43-L50

Added lines #L43 - L50 were not covered by tests
* })
* ```
* For OIDC Flow:
*
*```js
*```ts

Check warning on line 55 in packages/core/src/providers/boxyhq-saml.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/boxyhq-saml.ts#L55

Added line #L55 was not covered by tests
* import Auth from "@auth/core"
* import BoxyHQ from "@auth/core/providers/boxyhq-saml"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [BoxyHQ({
* clientId: BOXYHQ_SAML_CLIENT_ID,
* clientSecret: BOXYHQ_SAML_CLIENT_SECRET,
* issuer: BOXYHQ_SAML_ISSUER
* })],
* providers: [
* BoxyHQ({
* clientId: BOXYHQ_SAML_CLIENT_ID,
* clientSecret: BOXYHQ_SAML_CLIENT_SECRET,
* issuer: BOXYHQ_SAML_ISSUER,
* }),
* ],

Check warning on line 67 in packages/core/src/providers/boxyhq-saml.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/boxyhq-saml.ts#L61-L67

Added lines #L61 - L67 were not covered by tests
* })
* ```
*
Expand All @@ -78,7 +82,7 @@ export interface BoxyHQSAMLProfile extends Record<string, any> {
* On the client side you'll need to pass additional parameters `tenant` and `product` to the `signIn` function. This will allow BoxyHQL SAML to figure out the right SAML configuration and take your user to the right SAML Identity Provider to sign them in.
*
* ```tsx
* import { signIn } from "next-auth/react";
* import { signIn } from "auth";

Check warning on line 85 in packages/core/src/providers/boxyhq-saml.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/boxyhq-saml.ts#L85

Added line #L85 was not covered by tests
* ...
*
* // Map your users's email to a tenant and product
Expand Down
10 changes: 8 additions & 2 deletions packages/core/src/providers/bungie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ import type { OAuthConfig, OAuthUserConfig } from "./index.js"
* ```
*
* #### Configuration
*```js
*```ts

Check warning on line 24 in packages/core/src/providers/bungie.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/bungie.ts#L24

Added line #L24 was not covered by tests
* import Auth from "@auth/core"
* import Bungie from "@auth/core/providers/bungie"
*
* const request = new Request(origin)
* const response = await Auth(request, {
* providers: [Bungie({ clientId: BUNGIE_CLIENT_ID, clientSecret: BUNGIE_CLIENT_SECRET, headers: { "X-API-Key": BUNGIE_API_KEY } })],
* providers: [
* Bungie({
* clientId: BUNGIE_CLIENT_ID,
* clientSecret: BUNGIE_CLIENT_SECRET,
* headers: { "X-API-Key": BUNGIE_API_KEY },
* }),
* ],

Check warning on line 36 in packages/core/src/providers/bungie.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/providers/bungie.ts#L30-L36

Added lines #L30 - L36 were not covered by tests
* })
* ```
*
Expand Down
Loading

0 comments on commit 8db6a54

Please sign in to comment.