-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
Add authentication examples #3135
Merged
Merged
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
beea2c2
Add auth example
apedroferreira 4f572c2
Add examples themselves
apedroferreira 3193019
Update readme
apedroferreira 4c1c3f9
Remove pnpm workspace
apedroferreira 73e1f17
Merge remote-tracking branch 'upstream/master' into auth-example
apedroferreira 2fe534a
Remove Azure examples
apedroferreira 943c0b1
Remove more Azure and credentials
apedroferreira 7f81a06
Split examples for Github and Google, link to OAuth client instructio…
apedroferreira e4fc8a0
restore pnpm-lock
apedroferreira c2d6031
Merge remote-tracking branch 'upstream/master' into auth-example
apedroferreira d627874
Improve READMEs
apedroferreira 918134d
Fix readme links
apedroferreira cb30cff
Fix again
apedroferreira 4b487db
Link names
apedroferreira eb0c552
Better sections
apedroferreira e23ae14
Holy cow
apedroferreira dc9e303
Still wrong
apedroferreira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TOOLPAD_AUTH_SECRET=u43rXwzRvl4PDZhAqeciOW4KLfYIl2Aa9B5Wet+rJSI= | ||
|
||
TOOLPAD_GITHUB_CLIENT_ID= | ||
TOOLPAD_GITHUB_CLIENT_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# GitHub Authentication | ||
|
||
<p class="description">An app that shows how to set up GitHub authentication in Toolpad.</p> | ||
|
||
Example showcasing how to set up GitHub authentication in a Toolpad app. [The docs](https://mui.com/toolpad/concepts/authentication/). | ||
|
||
To use this example, you need to set up your own GitHub OAuth app. You can do that by following [these instructions](https://mui.com/toolpad/concepts/authentication/#github). | ||
|
||
<a target="_blank"> | ||
<img src="https://mui.com/static/toolpad/marketing/auth-github.png" alt="GitHub Authentication" style="aspect-ratio: 131/88;" width="524"> | ||
</a> | ||
|
||
## How to run | ||
|
||
Use `create-toolpad-app` to bootstrap the example: | ||
|
||
```bash | ||
npx create-toolpad-app@latest --example auth-github | ||
``` | ||
|
||
```bash | ||
yarn create toolpad-app --example auth-github | ||
``` | ||
|
||
```bash | ||
pnpm create toolpad-app --example auth-github | ||
``` | ||
|
||
or: | ||
|
||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/auth-github) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "auth-github", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "toolpad dev", | ||
"build": "toolpad build", | ||
"start": "toolpad start" | ||
}, | ||
"dependencies": { | ||
"@mui/toolpad": "0.1.49" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v1 | ||
kind: application | ||
spec: | ||
authentication: | ||
providers: | ||
- provider: github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/mui/mui-toolpad/v0.1.49/docs/schemas/v1/definitions.json#properties/Page | ||
|
||
apiVersion: v1 | ||
kind: page | ||
spec: | ||
alias: | ||
- sP_2TKM | ||
title: Protected Page | ||
displayName: Protected Page | ||
content: | ||
- component: Text | ||
name: text | ||
props: | ||
value: Only authenticated users can see me. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TOOLPAD_AUTH_SECRET=u43rXwzRvl4PDZhAqeciOW4KLfYIl2Aa9B5Wet+rJSI= | ||
|
||
TOOLPAD_GOOGLE_CLIENT_ID= | ||
TOOLPAD_GOOGLE_CLIENT_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Google Authentication | ||
|
||
<p class="description">An app that shows how to set up Google authentication in Toolpad.</p> | ||
|
||
Example showcasing how to set up Google authentication in a Toolpad app. [The docs](https://mui.com/toolpad/concepts/authentication/). | ||
|
||
To use this example, you need to set up your own Google OAuth client ID. You can do that by following [these instructions](https://mui.com/toolpad/concepts/authentication/#google). | ||
|
||
<a target="_blank"> | ||
<img src="https://mui.com/static/toolpad/marketing/auth-google.png" alt="Google Authentication" style="aspect-ratio: 131/88;" width="524"> | ||
</a> | ||
|
||
## How to run | ||
|
||
Use `create-toolpad-app` to bootstrap the example: | ||
|
||
```bash | ||
npx create-toolpad-app@latest --example auth-google | ||
``` | ||
|
||
```bash | ||
yarn create toolpad-app --example auth-google | ||
``` | ||
|
||
```bash | ||
pnpm create toolpad-app --example auth-google | ||
``` | ||
|
||
or: | ||
|
||
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/fork/github/mui/mui-toolpad/tree/master/examples/auth-google) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "auth-google", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "toolpad dev", | ||
"build": "toolpad build", | ||
"start": "toolpad start" | ||
}, | ||
"dependencies": { | ||
"@mui/toolpad": "0.1.49" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v1 | ||
kind: application | ||
spec: | ||
authentication: | ||
providers: | ||
- provider: google |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/mui/mui-toolpad/v0.1.49/docs/schemas/v1/definitions.json#properties/Page | ||
|
||
apiVersion: v1 | ||
kind: page | ||
spec: | ||
alias: | ||
- sP_2TKM | ||
title: Protected Page | ||
displayName: Protected Page | ||
content: | ||
- component: Text | ||
name: text | ||
props: | ||
value: Only authenticated users can see me. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I don't include
/toolpad
it creates the files outside thetoolpad
folder, that's not expected, right? Or am I doing something wrong?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this get resolved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works well after this change and it matches the command that was already in step 3 above it, so I'm pretty sure this should be the way to write it.