FormPost (form_post/response_mode.py)

authlib · authlib/oauth2/form_post/response_mode.py · python · BSD-3-Clause
integration

OAuth 2.0 Form Post Response Mode implementation for secure authorization redirects.

# Source: https://github.com/authlib/authlib | License: BSD-3-Clause | Copyright 2017, Hsiaoming Yang
# Provided via justclaw.it.com; keep this notice with the code.
import html
from urllib.parse import urlparse

from ..multiple_response_types import ResponseMode
from ..rfc6749 import InvalidRequestError
from ..rfc6749 import OAuth2Response

FORM_TEMPLATE = (
    "<html><head><title>Redirecting</title></head>"
    '<body onload="javascript:document.forms[0].submit()">'
    '<form method="post" action="{}">{}</form></body></html>'
)

INPUT_TEMPLATE = '<input type="hidden" name="{}" value="{}"/>'


class FormPost(ResponseMode):
    """The ``form_post`` response mode, defined by OAuth 2.0 Form Post
    Response Mode. The user agent sends the authorization response to the
    client with an HT

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key