oauthwebview package

This package is a WebView specialized for handling OAuth authorization code flows.

OAuthWebView class

class tatogalib.ui.oauthwebview.OAuthWebView(*args, **kwargs)

A custom WebView for Windows and Android to implement the OAuth Code Flow as specified in RFC 6749

from tatogalib.ui.oauthwebview import OAuthWebView
webView = OAuthWebView(style=Pack(flex=1))
code = await webView.get_authorization_code(auth_url)

Create a new WebView widget.

Parameters:
  • id – The ID for the widget.

  • style – A style object. If no style is provided, a default style will be applied to the widget.

  • url – The full URL to load in the WebView. If not provided, an empty page will be displayed.

  • content – The HTML content to display in the WebView. If content is provided, the value of url will be used as the root URL for the content that is displayed; this URL will be used to resolve any relative URLs in the content. Note: On Android and Windows, if content is specified, any value provided for the url argument will be ignored.

  • user_agent – The user agent to use for web requests. If not provided, the default user agent for the platform will be used.

  • on_navigation_starting – A handler that will be invoked when the web view is requesting permission to navigate or redirect to a different URI.

  • on_webview_load – A handler that will be invoked when the web view finishes loading.

  • kwargs – Initial style properties.

abort_oauth_code_flow()

Stop waiting for the authorization code

async get_authorization_code(auth_url)

Start the OAuth Code Flow and wait for the authorisation code

Parameters:

auth_url (str) – The auth URL to call. It must contain the auth endpoint, the response_type=code, the client_id and the redirect_uri

Returns:

The authorization code or None

Return type:

str | None