File: //usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/__pycache__/parameters.cpython-310.pyc
o
���aHJ � @ s� d Z ddlZddlZddlZddlmZ ddlmZm Z ddl
mZ ddlm
Z
mZmZmZmZmZ ddlmZ ddlmZmZmZ dd
d�Zddd�Z ddd�Zddd�Zddd�Zddd�Zdd� ZdS ) z�
oauthlib.oauth2.rfc6749.parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains methods related to `Section 4`_ of the OAuth 2 RFC.
.. _`Section 4`: https://tools.ietf.org/html/rfc6749#section-4
� N)�add_params_to_qs�add_params_to_uri)�
scope_changed� )�InsecureTransportError�MismatchingStateError�MissingCodeError�MissingTokenError�MissingTokenTypeError�raise_from_error)�OAuth2Token)�is_secure_transport�
list_to_scope�
scope_to_list�plainc K s� t | �st� �d|fd|fg} |r| �d|f� |r#| �dt|�f� |r,| �d|f� |dur>| �d|f� | �d|f� |D ]}
||
rQ| �t|
�||
f� q@t| | �S ) a] Prepare the authorization grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
using the ``application/x-www-form-urlencoded`` format as defined by
[`W3C.REC-html401-19991224`_]:
:param uri:
:param client_id: The client identifier as described in `Section 2.2`_.
:param response_type: To indicate which OAuth 2 grant/flow is required,
"code" and "token".
:param redirect_uri: The client provided URI to redirect back to after
authorization as described in `Section 3.1.2`_.
:param scope: The scope of the access request as described by
`Section 3.3`_.
:param state: An opaque value used by the client to maintain
state between the request and callback. The authorization
server includes this value when redirecting the user-agent
back to the client. The parameter SHOULD be used for
preventing cross-site request forgery as described in
`Section 10.12`_.
:param code_challenge: PKCE paramater. A challenge derived from the
code_verifier that is sent in the authorization
request, to be verified against later.
:param code_challenge_method: PKCE parameter. A method that was used to derive the
code_challenge. Defaults to "plain" if not present in the request.
:param kwargs: Extra arguments to embed in the grant/authorization URL.
An example of an authorization code grant authorization URL:
.. code-block:: http
GET /authorize?response_type=code&client_id=s6BhdRkqt3&state=xyz
&code_challenge=kjasBS523KdkAILD2k78NdcJSk2k3KHG6&code_challenge_method=S256
&redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb HTTP/1.1
Host: server.example.com
.. _`W3C.REC-html401-19991224`: https://tools.ietf.org/html/rfc6749#ref-W3C.REC-html401-19991224
.. _`Section 2.2`: https://tools.ietf.org/html/rfc6749#section-2.2
.. _`Section 3.1.2`: https://tools.ietf.org/html/rfc6749#section-3.1.2
.. _`Section 3.3`: https://tools.ietf.org/html/rfc6749#section-3.3
.. _`section 10.12`: https://tools.ietf.org/html/rfc6749#section-10.12
�
response_type� client_id�redirect_uri�scope�stateN�code_challenge�code_challenge_method)r
r �appendr �strr )�urir r r r r r r �kwargs�params�k� r �D/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/parameters.py�prepare_grant_uri s&