File: //usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/__pycache__/parameters.cpython-38.pyc
U
��I]�F � @ s d Z ddlmZmZ ddlZddlZddlZddlmZm Z m
Z
ddlmZ ddl
mZmZmZmZmZmZ ddlmZ dd lmZmZmZ zddlZW n ek
r� ddlmZ Y nX dd
d�Zddd�Zddd�Z ddd�Z!ddd�Z"d dd�Z#dd� Z$dS )!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
� )�absolute_import�unicode_literalsN)�add_params_to_qs�add_params_to_uri�unicode_type)�
scope_changed� )�InsecureTransportError�MismatchingStateError�MissingCodeError�MissingTokenError�MissingTokenTypeError�raise_from_error)�OAuth2Token)�is_secure_transport�
list_to_scope�
scope_to_listc K s� t | �st� �d|fd|fg}|r0|�d|f� |rF|�dt|�f� |rX|�d|f� |D ]"}|| r\|�t|�|| f� q\t| |�S )ap 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 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
&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�state)r r �appendr r r ) �urir r r r r �kwargs�params�k� r �D/usr/lib/python3/dist-packages/oauthlib/oauth2/rfc6749/parameters.py�prepare_grant_uri s '�r � Tc K s� d| fg}d|kr"t |d �|d<