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

Solara auth0 example #220

Merged
merged 8 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion doc/apps/solara.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,22 @@ ploomber-cloud deploy --watch
To ensure your app doesn't break on re-deployments, pin your [dependencies.](pin-dependencies)
```

## Production deployments

Ploomber has features to help you deploy production-ready Solara apps

### Authentication

Our [integration with Auth0](auth0-integration) allows you to easily add authentication
to any Solara app. There's no need to modify your Solara app code, only pass your
Auth0 configuration parameters. Check out the [sample app.](https://github.com/ploomber/doc/tree/main/examples/solara/app-with-auth0)

## Features

Ploomber Cloud supports many features to help you build Solara applications quickly!

- Integration with [GitHub](../user-guide/github.md)
- Safely store [secrets](../user-guide/secrets.md) such as API keys
- Add [password protection](../user-guide/password.md) to your app
- Usage [analytics](../user-guide/analytics.md) such as unique visitors, total requests, etc.
- Spin up [larger resources](../user-guide/resources.md) (CPUs and RAM)
- Spin up [GPUs](../user-guide/gpu.md)
Expand Down
24 changes: 24 additions & 0 deletions examples/solara/app-with-auth0/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import solara
import plotly.express as px
from solara.lab import headers

df = px.data.iris()

columns = list(df.columns)
x_axis = solara.reactive("sepal_length")
y_axis = solara.reactive("sepal_width")


@solara.component
def Page():
if 'x-auth-name' in headers.value:
username = headers.value['x-auth-name'][0]
else:
username = "Anonymous"
solara.Markdown(f"Welcome {username}!")
solara.Markdown("[Logout](/logout)")

fig = px.scatter(df, x_axis.value, y_axis.value)
solara.FigurePlotly(fig)
solara.Select(label="X-axis", value=x_axis, values=columns)
solara.Select(label="Y-axis", value=y_axis, values=columns)
3 changes: 3 additions & 0 deletions examples/solara/app-with-auth0/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
solara
plotly
pandas