Skip to content

Commit

Permalink
Add python shiny express oauth test app
Browse files Browse the repository at this point in the history
  • Loading branch information
dbkegley committed Jul 30, 2024
1 parent 97b0355 commit e4e2e94
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
11 changes: 11 additions & 0 deletions local/python-shiny-express-oauth-app/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from posit import connect
from shiny.express import render, session

# Runs once per startup
client = connect.Client()

# Runs once per session
@render.text
def access_token():
user_session_token = session.http_conn.headers.get("Posit-Connect-User-Session-Token")
return client.oauth.get_credentials(user_session_token).get("access_token")
24 changes: 24 additions & 0 deletions local/python-shiny-express-oauth-app/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": 1,
"locale": "en_US.UTF-8",
"metadata": {
"appmode": "python-shiny",
"entrypoint": "shiny.express.app:app_2e_py"
},
"python": {
"version": "3.11.3",
"package_manager": {
"name": "pip",
"version": "24.1.1",
"package_file": "requirements.txt"
}
},
"files": {
"requirements.txt": {
"checksum": "ef98e3be14a319ebb9f1d215e1df58ea"
},
"app.py": {
"checksum": "4ee2ac2b5117b68af1c69536e9c0f9f0"
}
}
}
2 changes: 2 additions & 0 deletions local/python-shiny-express-oauth-app/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
posit-sdk==0.3.1
shiny==1.0.0

0 comments on commit e4e2e94

Please sign in to comment.