1.16.10

flytekit.clients.auth.token_client

Directory

Classes

Class Description
DeviceCodeResponse Response from device auth flow endpoint.
GrantType str(object=’’) -> str.

Methods

Method Description
get_basic_authorization_header() This function transforms the client id and the client secret into a header that conforms with http basic auth.
get_device_code() Retrieves the device Authentication code that can be done to authenticate the request using a browser on a.
get_token() :rtype: (Text,Text,Int) The first element is the access token retrieved from the IDP, the second is the refresh token.
poll_token_endpoint()

Variables

Property Type Description
error_auth_pending str
error_slow_down str
utf_8 str

Methods

get_basic_authorization_header()

def get_basic_authorization_header(
    client_id: str,
    client_secret: str,
) -> str

This function transforms the client id and the client secret into a header that conforms with http basic auth. It joins the id and the secret with a : then base64 encodes it, then adds the appropriate text. Secrets are first URL encoded to escape illegal characters.

Parameter Type Description
client_id str str
client_secret str str :rtype: str

get_device_code()

def get_device_code(
    device_auth_endpoint: str,
    client_id: str,
    audience: typing.Optional[str],
    scope: typing.Optional[typing.List[str]],
    http_proxy_url: typing.Optional[str],
    verify: typing.Union[bool, str, NoneType],
    session: typing.Optional[requests.sessions.Session],
) -> flytekit.clients.auth.token_client.DeviceCodeResponse

Retrieves the device Authentication code that can be done to authenticate the request using a browser on a separate device

Parameter Type Description
device_auth_endpoint str
client_id str
audience typing.Optional[str]
scope typing.Optional[typing.List[str]]
http_proxy_url typing.Optional[str]
verify typing.Union[bool, str, NoneType]
session typing.Optional[requests.sessions.Session]

get_token()

def get_token(
    token_endpoint: str,
    scopes: typing.Optional[typing.List[str]],
    authorization_header: typing.Optional[str],
    client_id: typing.Optional[str],
    device_code: typing.Optional[str],
    audience: typing.Optional[str],
    grant_type: <enum 'GrantType'>,
    http_proxy_url: typing.Optional[str],
    verify: typing.Union[bool, str, NoneType],
    session: typing.Optional[requests.sessions.Session],
    refresh_token: typing.Optional[str],
) -> typing.Tuple[str, str, int]

:rtype: (Text,Text,Int) The first element is the access token retrieved from the IDP, the second is the refresh token retrieved from the IDP, the third is the expiration in seconds

Parameter Type Description
token_endpoint str
scopes typing.Optional[typing.List[str]]
authorization_header typing.Optional[str]
client_id typing.Optional[str]
device_code typing.Optional[str]
audience typing.Optional[str]
grant_type <enum 'GrantType'>
http_proxy_url typing.Optional[str]
verify typing.Union[bool, str, NoneType]
session typing.Optional[requests.sessions.Session]
refresh_token typing.Optional[str]

poll_token_endpoint()

def poll_token_endpoint(
    resp: flytekit.clients.auth.token_client.DeviceCodeResponse,
    token_endpoint: str,
    client_id: str,
    audience: typing.Optional[str],
    scopes: typing.Optional[typing.List[str]],
    http_proxy_url: typing.Optional[str],
    verify: typing.Union[bool, str, NoneType],
) -> typing.Tuple[str, str, int]
Parameter Type Description
resp flytekit.clients.auth.token_client.DeviceCodeResponse
token_endpoint str
client_id str
audience typing.Optional[str]
scopes typing.Optional[typing.List[str]]
http_proxy_url typing.Optional[str]
verify typing.Union[bool, str, NoneType]

flytekit.clients.auth.token_client.DeviceCodeResponse

Response from device auth flow endpoint {‘device_code’: ‘code’, ‘user_code’: ‘BNDJJFXL’, ‘verification_uri’: ‘url’, ’expires_in’: 600, ‘interval’: 5}

class DeviceCodeResponse(
    device_code: str,
    user_code: str,
    verification_uri: str,
    expires_in: int,
    interval: int,
)
Parameter Type Description
device_code str
user_code str
verification_uri str
expires_in int
interval int

Methods

Method Description
from_json_response()

from_json_response()

def from_json_response(
    j: typing.Dict,
) -> DeviceCodeResponse
Parameter Type Description
j typing.Dict

flytekit.clients.auth.token_client.GrantType

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to ‘utf-8’. errors defaults to ‘strict’.

class GrantType(
    args,
    kwds,
)
Parameter Type Description
args *args
kwds