Skip to content

Commit

Permalink
better messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Jun 19, 2024
1 parent 1b914f2 commit 3a800f4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/google-one-tap-auth/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,18 @@ def main_page(request: Request):
assert core.air.remote_url
if 'on-air.io' not in request.url.hostname:
return RedirectResponse(core.air.remote_url)

if not GOOGLE_CLIENT_ID:
ui.label('Please set the GOOGLE_CLIENT_ID environment variable')
return

ui.add_head_html('<script src="https://accounts.google.com/gsi/client" async defer></script>')
ui.html(f'''
<div id="g_id_onload"
data-client_id="{GOOGLE_CLIENT_ID}"
data-login_uri="{core.air.remote_url}auth/google">
</div>''')
ui.button('Click', on_click=lambda: ui.run_javascript('fail()'))
ui.label('Sign in with Google One Tap')


@app.post('/auth/google')
Expand Down

0 comments on commit 3a800f4

Please sign in to comment.