# Reference

## Requests OAuth 1.0

class authlib.integrations.requests_client.OAuth1Session(client_id, client_secret=None, token=None, token_secret=None, redirect_uri=None, rsa_key=None, verifier=None, signature_method='HMAC-SHA1', signature_type='HEADER', force_include_body=False, **kwargs)
  create_authorization_url(url, request_token=None, **kwargs)

    Create an authorization URL by appending request_token and optional kwargs to url.

    This is the second step in the OAuth 1 workflow. The user should be redirected to this authorization URL, grant access to you, and then be redirected back to you. The redirection back can either be specified during client registration or by supplying a callback URI per request.

    Parameters:

      - url – The authorization endpoint URL.

      - request_token – The previously obtained request token.

      - kwargs – Optional parameters to append to the URL.

    Returns:

      The authorization URL with new parameters embedded.

  fetch_access_token(url, verifier=None, **kwargs)

    Method for fetching an access token from the token endpoint.

    This is the final step in the OAuth 1 workflow. An access token is obtained using all previously obtained credentials, including the verifier from the authorization step.

    Parameters:

      - url – Access Token endpoint.

      - verifier – A verifier string to prove authorization was granted.

      - kwargs – Extra parameters to include for fetching access token.

    Returns:

      A token dict.

  fetch_request_token(url, **kwargs)

    Method for fetching an access token from the token endpoint.

    This is the first step in the OAuth 1 workflow. A request token is obtained by making a signed post request to url. The token is then parsed from the application/x-www-form-urlencoded response and ready to be used to construct an authorization url.

    Parameters:

      - url – Request Token endpoint.

      - kwargs – Extra parameters to include for fetching token.

    Returns:

      A Request Token dict.

  parse_authorization_response(url)

    Extract parameters from the post authorization redirect response URL.

    Parameters:

      url – The full URL that resulted from the user being redirected back from the OAuth provider to you, the client.

    Returns:

      A dict of parameters extracted from the URL.

class authlib.integrations.requests_client.OAuth1Auth(client_id, client_secret=None, token=None, token_secret=None, redirect_uri=None, rsa_key=None, verifier=None, signature_method='HMAC-SHA1', signature_type='HEADER', realm=None, force_include_body=False)

  Signs the request using OAuth 1 (RFC5849).

## HTTPX OAuth 1.0

class authlib.integrations.httpx_client.OAuth1Auth(client_id, client_secret=None, token=None, token_secret=None, redirect_uri=None, rsa_key=None, verifier=None, signature_method='HMAC-SHA1', signature_type='HEADER', realm=None, force_include_body=False)

  Signs the httpx request using OAuth 1 (RFC5849).

  auth_flow(request: Request) → Generator[Request, Response, None]

    Execute the authentication flow.

    To dispatch a request, yield it:

    `` yield request ``

    The client will .send() the response back into the flow generator. You can access it like so:

    `` response = yield request ``

    A return (or reaching the end of the generator) will result in the client returning the last response obtained from the server.

    You can dispatch as many requests as is necessary.

class authlib.integrations.httpx_client.OAuth1Client(client_id, client_secret=None, token=None, token_secret=None, redirect_uri=None, rsa_key=None, verifier=None, signature_method='HMAC-SHA1', signature_type='HEADER', force_include_body=False, **kwargs)
  create_authorization_url(url, request_token=None, **kwargs)

    Create an authorization URL by appending request_token and optional kwargs to url.

    This is the second step in the OAuth 1 workflow. The user should be redirected to this authorization URL, grant access to you, and then be redirected back to you. The redirection back can either be specified during client registration or by supplying a callback URI per request.

    Parameters:

      - url – The authorization endpoint URL.

      - request_token – The previously obtained request token.

      - kwargs – Optional parameters to append to the URL.

    Returns:

      The authorization URL with new parameters embedded.

  fetch_access_token(url, verifier=None, **kwargs)

    Method for fetching an access token from the token endpoint.

    This is the final step in the OAuth 1 workflow. An access token is obtained using all previously obtained credentials, including the verifier from the authorization step.

    Parameters:

      - url – Access Token endpoint.

      - verifier – A verifier string to prove authorization was granted.

      - kwargs – Extra parameters to include for fetching access token.

    Returns:

      A token dict.

  fetch_request_token(url, **kwargs)

    Method for fetching an access token from the token endpoint.

    This is the first step in the OAuth 1 workflow. A request token is obtained by making a signed post request to url. The token is then parsed from the application/x-www-form-urlencoded response and ready to be used to construct an authorization url.

    Parameters:

      - url – Request Token endpoint.

      - kwargs – Extra parameters to include for fetching token.

    Returns:

      A Request Token dict.

  parse_authorization_response(url)

    Extract parameters from the post authorization redirect response URL.

    Parameters:

      url – The full URL that resulted from the user being redirected back from the OAuth provider to you, the client.

    Returns:

      A dict of parameters extracted from the URL.

class authlib.integrations.httpx_client.AsyncOAuth1Client(client_id, client_secret=None, token=None, token_secret=None, redirect_uri=None, rsa_key=None, verifier=None, signature_method='HMAC-SHA1', signature_type='HEADER', force_include_body=False, **kwargs)
  create_authorization_url(url, request_token=None, **kwargs)

    Create an authorization URL by appending request_token and optional kwargs to url.

    This is the second step in the OAuth 1 workflow. The user should be redirected to this authorization URL, grant access to you, and then be redirected back to you. The redirection back can either be specified during client registration or by supplying a callback URI per request.

    Parameters:

      - url – The authorization endpoint URL.

      - request_token – The previously obtained request token.

      - kwargs – Optional parameters to append to the URL.

    Returns:

      The authorization URL with new parameters embedded.

  async fetch_access_token(url, verifier=None, **kwargs)

    Method for fetching an access token from the token endpoint.

    This is the final step in the OAuth 1 workflow. An access token is obtained using all previously obtained credentials, including the verifier from the authorization step.

    Parameters:

      - url – Access Token endpoint.

      - verifier – A verifier string to prove authorization was granted.

      - kwargs – Extra parameters to include for fetching access token.

    Returns:

      A token dict.

  fetch_request_token(url, **kwargs)

    Method for fetching an access token from the token endpoint.

    This is the first step in the OAuth 1 workflow. A request token is obtained by making a signed post request to url. The token is then parsed from the application/x-www-form-urlencoded response and ready to be used to construct an authorization url.

    Parameters:

      - url – Request Token endpoint.

      - kwargs – Extra parameters to include for fetching token.

    Returns:

      A Request Token dict.

  parse_authorization_response(url)

    Extract parameters from the post authorization redirect response URL.

    Parameters:

      url – The full URL that resulted from the user being redirected back from the OAuth provider to you, the client.

    Returns:

      A dict of parameters extracted from the URL.