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

[cli] Bootstrap authentication from create-toolpad-app #3860

Merged
merged 54 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c318eb2
feat: Upgrade to `@inquirer/prompts` instead of `inquirer`
bharatkashyap Jul 25, 2024
07956f3
fix: Clean up
bharatkashyap Jul 25, 2024
276de4a
fix: pnpm dedupe
bharatkashyap Jul 25, 2024
bcfde32
feat: Add router, auth and authProvider options
bharatkashyap Jul 25, 2024
2a593ea
wip: Auth content to `generateProject`
bharatkashyap Jul 26, 2024
6e269e0
wip: `auth` content to `generateProject`
bharatkashyap Jul 26, 2024
750df0d
wip: Add auth files
bharatkashyap Jul 28, 2024
1e6ac4f
wip: Next.js app auth
bharatkashyap Jul 28, 2024
92b9e2d
fix: Resolve auth deps
bharatkashyap Jul 28, 2024
4f359b6
wip: Move back to using strings
bharatkashyap Jul 30, 2024
350ef08
fix: Clean up
bharatkashyap Jul 30, 2024
37a7af8
fix: Make app-router code gen work
bharatkashyap Jul 30, 2024
c6df83f
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Jul 30, 2024
4a739e7
fix: Format `auth.ts` correctly
bharatkashyap Jul 30, 2024
323bb6b
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 1, 2024
f3832b0
wip: Bring in changes from core tutorial to avoid complicated merge
bharatkashyap Aug 1, 2024
42408d2
fix: Organize template strings, add pages router branch
bharatkashyap Aug 1, 2024
f35b847
fix: CI
bharatkashyap Aug 1, 2024
7caee7a
Merge branch 'master' into cta/auth
bharatkashyap Aug 1, 2024
a059b24
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 2, 2024
8624925
fix: Type template strings, docs changes
bharatkashyap Aug 2, 2024
037f750
Merge branch 'master' into cta/auth
bharatkashyap Aug 2, 2024
e8569e8
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 5, 2024
26e45bb
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 6, 2024
adc2b8d
fix: Ensure compatibility with v5
bharatkashyap Aug 6, 2024
eb068b4
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 8, 2024
938102d
fix: CI
bharatkashyap Aug 8, 2024
b32eae5
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 9, 2024
6a55cce
fix: Prepare for `v5` compatibility
bharatkashyap Aug 9, 2024
e12c87a
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 12, 2024
5dcf5ee
fix: Update to match examples
bharatkashyap Aug 12, 2024
ecf7e38
fix: Update tests
bharatkashyap Aug 13, 2024
651ade2
Merge branch 'master' into cta/auth
bharatkashyap Aug 13, 2024
17b441f
Merge branch 'master' into cta/auth
bharatkashyap Aug 13, 2024
4835407
fix: Only for debugging
bharatkashyap Aug 13, 2024
b93b64e
Merge branch 'cta/auth' of github.com:bharatkashyap/mui-toolpad into …
bharatkashyap Aug 13, 2024
740f1c9
fix: Move `credentials` out, for later
bharatkashyap Aug 16, 2024
c632dd1
fix: Keep Credentials generation, only remove option
bharatkashyap Aug 16, 2024
285bd93
fix: Jan review
bharatkashyap Aug 18, 2024
1448029
Merge branch 'master' into cta/auth
bharatkashyap Aug 18, 2024
1671b57
fix: CI
bharatkashyap Aug 18, 2024
c1d1653
Merge branch 'cta/auth' of github.com:bharatkashyap/mui-toolpad into …
bharatkashyap Aug 18, 2024
1df00de
fix: missed
bharatkashyap Aug 18, 2024
a8abaad
fix: CI
bharatkashyap Aug 18, 2024
ebbbb11
fix: Jan review 2
bharatkashyap Aug 19, 2024
2f4edd0
Fix page content
Janpot Aug 20, 2024
efe82c8
fix page content
Janpot Aug 20, 2024
541e0b3
Update indexPage.ts
Janpot Aug 20, 2024
d36ad3a
Merge branch 'master' into cta/auth
bharatkashyap Aug 22, 2024
0763c02
fix: CI
bharatkashyap Aug 22, 2024
d643df0
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 22, 2024
b48a96a
fix: CI
bharatkashyap Aug 22, 2024
a7e6e72
fix: CI
bharatkashyap Aug 22, 2024
8156226
Merge branch 'master' of github.com:mui/mui-toolpad into cta/auth
bharatkashyap Aug 22, 2024
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
25 changes: 19 additions & 6 deletions docs/data/toolpad/core/components/sign-in-page/sign-in-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,31 @@ The component is composable with any authentication library you might want to us

#### Setting up

If you're using the default [Next.js app directory example](https://github.com/mui/mui-toolpad/tree/master/examples/core-auth-nextjs/), Auth.js is already installed. Otherwise, follow the [installation instructions](https://authjs.dev/getting-started/installation).
If you're using [`create-toolpad-app`](/toolpad/core/installation/), or the [Next.js app directory example](https://github.com/mui/mui-toolpad/tree/master/examples/core-auth-nextjs/), Auth.js is already installed. To proceed, add `AUTH_SECRET` to the environment variables by running:

```bash
npx auth secret
```

Otherwise, follow the detailed [Auth.js installation instructions](https://authjs.dev/getting-started/installation).

##### GitHub configuration

To get the required credentials, create an application in the GitHub developer settings. Read this [guide on Auth.js](https://authjs.dev/guides/configuring-github#adding-environment-variables) on how to obtain those.

If you already have a `CLIENT_ID` and `CLIENT_SECRET`, you can skip this step and add them to the environment variables, like so:

```bash title=".env.local"
GITHUB_CLIENT_ID=<your-client-id>
GITHUB_CLIENT_SECRET=<your-client-secret>
```

##### Server Configuration

If you're using [`create-toolpad-app`](/toolpad/core/installation/), or the default [Next.js app directory example](https://github.com/mui/mui-toolpad/tree/master/examples/core-auth-nextjs/), this server configuration is already set up for you.

Otherwise, follow the [custom sign in page instructions](https://authjs.dev/guides/pages/signin) to set up the server configuration.

The `SignInPage` component can slot in as a custom sign in page inside Auth.js:

```ts title="./auth.ts"
Expand All @@ -74,7 +91,7 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
// ...
```

You can then have a fully built GitHub sign in page appear at `/auth/signin` by adding `SignInPage` to `page.tsx`:
To have a fully built "Sign in with GitHub" page appear at the `/auth/signin` route, add `SignInPage` to `page.tsx`:

```tsx title="./app/auth/signin/page.tsx"
// ...
Expand Down Expand Up @@ -126,10 +143,6 @@ export default function SignIn() {
}
```

:::info
If you're using the default [Next.js app directory example](https://github.com/mui/mui-toolpad/tree/master/examples/core-auth-nextjs/), all of this is already configured for you. Otherwise, follow the [custom sign in page instructions](https://authjs.dev/guides/pages/signin).
:::

## Customization

### Theme and Branding
Expand Down
Loading
Loading