(20250625) - Implemented the ecommerce shopify auth integration.
with multiple files added new API for get token details
This commit is contained in:
@@ -236,6 +236,29 @@ async def authorize_software_client(
|
||||
success = response.success
|
||||
message = f"Action Chain '{response.actionChain}': {response.message}"
|
||||
|
||||
elif inbound_data.softwareClient == "shopify":
|
||||
# Make the client controller test and save the auth:
|
||||
response = await current_app.shopify_controller.save_auth(
|
||||
sql_conn=current_app.sql_writer,
|
||||
mongo_data_conn=current_app.data_mongo,
|
||||
auth=inbound_data.auth,
|
||||
user=kwargs.get("session_info"),
|
||||
session_token=inbound_headers.get("X-Session-Token")
|
||||
)
|
||||
|
||||
# Note down the results:
|
||||
success = response.success
|
||||
message = response.message
|
||||
token_id = response.token_id
|
||||
|
||||
auth_url_success = ""
|
||||
auth_url_failed = ""
|
||||
|
||||
if token_id is not None:
|
||||
auth_url_success = f"https://api.thecaoffice.com/shopify/auth/template?status=1&token={token_id}&storeName={inbound_data.auth.storeName}&storeUrl={inbound_data.auth.storeUrl}"
|
||||
else:
|
||||
auth_url_failed = f"https://api.thecaoffice.com/shopify/auth/template?status=0&storeName={inbound_data.auth.storeName}&storeUrl={inbound_data.auth.storeUrl}"
|
||||
|
||||
# ┳┓
|
||||
# ┣┫┏┓┏┏┓┏┓┏┓┏┏┓
|
||||
# ┛┗┗ ┛┣┛┗┛┛┗┛┗
|
||||
@@ -248,7 +271,8 @@ async def authorize_software_client(
|
||||
message = message,
|
||||
data = {
|
||||
"client": inbound_data.softwareClient,
|
||||
"authorized": success
|
||||
"authorized": success,
|
||||
"authorizationUrl": auth_url_success if success else auth_url_failed
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user