Skip to content

Commit

Permalink
Solara auth0 example (#220)
Browse files Browse the repository at this point in the history
* env

* img updated

* fixes

* solara auth0

* irrelevant

* revert

* revert

* guide
  • Loading branch information
neelasha23 authored May 10, 2024
1 parent c62a969 commit 5b2cab3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
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

0 comments on commit 5b2cab3

Please sign in to comment.