Last active
September 26, 2020 05:55
-
-
Save joyrexus/3d6d331278d07e6bbc6a3293d2823d19 to your computer and use it in GitHub Desktop.
Shopify App Installation URL via AWS Lambda (Python)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://help.shopify.com/api/guides/authentication/oauth#scopes | |
scopes = [] | |
scopes.append('read_content') | |
scopes.append('write_content') | |
scopes.append('read_themes') | |
scopes.append('write_themes') | |
scopes.append('read_products') | |
scopes.append('write_products') | |
scopes.append('read_customers') | |
scopes.append('write_customers') | |
scopes.append('read_orders') | |
scopes.append('write_orders') | |
scopes.append('read_script_tags') | |
scopes.append('write_script_tags') | |
scopes.append('read_fulfillments') | |
scopes.append('write_fulfillments') | |
scopes.append('read_shipping') | |
scopes.append('write_shipping') | |
scopes.append('read_analytics') | |
# scopes.append('read_users') Plus only | |
# scopes.append('write_users') Plus only | |
# Replace the variables below | |
api_key = "[[API_KEY]]" | |
redirect_uri = "[[REDIRECT_URL]]" | |
#TODO persistent nonce so that callback function can verify | |
nonce = "[[NONCE]]" | |
def lambda_handler(event, context): | |
install_url = 'https://' + event.get('store') + ".myshopify.com" + \ | |
'/admin/oauth/authorize?client_id=' + api_key + \ | |
'&scope=' + ','.join(scopes) + \ | |
'&state=' + nonce + \ | |
'&redirect_uri=' + redirect_uri | |
return { | |
'location': install_url | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment