nat.front_ends.fastapi.html_snippets.auth_code_grant_success#
Attributes#
Functions#
Build the redirect-based authentication success HTML page. |
Module Contents#
- AUTH_REDIRECT_SUCCESS_HTML = Multiline-String#
Show Value
""" <!DOCTYPE html> <html> <head> <title>Authentication Complete</title> <script> (function () { window.history.replaceState(null, "", window.location.pathname); window.opener?.postMessage({ type: 'AUTH_SUCCESS' }, '*'); window.close(); })(); </script> </head> <body> <p>Authentication complete. You may now close this window.</p> </body> </html> """
- _AUTH_REDIRECT_SUCCESS_HTML_REDIRECT_TEMPLATE = Multiline-String#
Show Value
"""<!DOCTYPE html> <html> <head> <title>Authentication Complete</title> <script> (function () { var returnTo = RETURN_URL_PLACEHOLDER; if (returnTo) { var url = new URL(returnTo); url.searchParams.set('oauth_auth_completed', 'true'); window.location.replace(url.toString()); } else { window.history.back(); } })(); </script> </head> <body> <p>Authentication complete. Redirecting…</p> </body> </html> """
- build_auth_redirect_success_html(return_url: str | None = None) str#
Build the redirect-based authentication success HTML page.
- Args:
- return_url: The URL to redirect to after successful authentication. When
provided the page navigates there immediately with an
oauth_auth_completedquery parameter so the UI can distinguish a successful return from the user pressing back; otherwise it falls back towindow.history.back().
- Returns:
An HTML string for the post-authentication redirect page.