Skip to content

module oauth.exchange_token


function exchange_token

exchange_token(
    shop: str,
    code: str,
    api_key: str,
    api_secret_key: str
)  Union[OnlineTokenModel, OfflineTokenModel]

Exchanges the temporary authorization code with Shopify for a token.

All prior security checks must already have been completed.

Args:

  • shop (str): The name of the merchant's shop. example.myshopify.com
  • code (str): The authorization code provided in the redirect.
  • api_key (str): The API key for the app, as defined in the Shopify Partner Dashboard.
  • api_secret_key (str): The API secret key for the app, as defined in the Shopify Partner Dashboard.

Returns:


function exchange_offline_token

exchange_offline_token(
    shop: str,
    code: str,
    api_key: str,
    api_secret_key: str
)  OfflineTokenModel

Exchanges the temporary authorization code with Shopify for an offline token.

Can be used instead of exchange_token when you know by some mechanism it will only be an offline token.

All prior security checks must already have been completed.

Args:

  • shop (str): The name of the merchant's shop. example.myshopify.com
  • code (str): The authorization code provided in the redirect.
  • api_key (str): The API key for the app, as defined in the Shopify Partner Dashboard.
  • api_secret_key (str): The API secret key for the app, as defined in the Shopify Partner Dashboard.

Returns:

  • OfflineTokenModel: [Validated offline token response.]https://shopify.dev/apps/auth/oauth/access-modes#offline-access

function exchange_online_token

exchange_online_token(
    shop: str,
    code: str,
    api_key: str,
    api_secret_key: str
)  OnlineTokenModel

Exchanges the temporary authorization code with Shopify for an online token.

Can be used instead of exchange_token when you know by some mechanism it will only be an online token.

All prior security checks must already have been completed.

Args:

  • shop (str): The name of the merchant's shop. example.myshopify.com
  • code (str): The authorization code provided in the redirect.
  • api_key (str): The API key for the app, as defined in the Shopify Partner Dashboard.
  • api_secret_key (str): The API secret key for the app, as defined in the Shopify Partner Dashboard.

Returns:

  • OnlineTokenModel: [Validated online token response.]https://shopify.dev/apps/auth/oauth/access-modes#online-access

This file was automatically generated via lazydocs.