Plugin Install - Process:
...
Install requires registration as an app provider.
Checks by the Shopify shop URL if it exists, if not then proceeds with installation.
"shopUrl": "http://uextension.myshopify.com ",
"secureShopUrl": "https:\\/\\/uextension.myshopify.com",
Authentication process and Token exchange.
Retrieves the hmac & host & timestamp GET variable fields to prepare for authentication.
"hmac": "67265c0683abeab279465c633ccb98ed86bebe456cf396189e6283c61665b78d",
"host": "YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvdWV4dGVuc2lvbg",
"timestamp": "1720782483"
The app registers within Shopify and Customer’s shop.
Creates the App’s auth package with the new shop URL and a new Auth request.Code Block // Shopify Netcomm App ID & Key & URL $appConfig = $this->getNetcommAppConfig($secureShopUrl); // Creates static configuration for Shopify $shopifySdk = ShopifySDK::config($appConfig); // Auth calls static ShopifySDK config set earlier. This should redirect after the auth request is approved. AuthHelper::createAuthRequest(self::APP_SCOPES, $redirectUrl);
The auth request goes to Shopify which verifies and redirects the user to login and then passes the request to the call back callback method which will receive the Access Token and register the necessary webhooks with shopify retrieving a ID for each.
Privilege establishment.
Privileges are requested during authentication the result is a a install modal from Shopify asking user to approve the App’s privilege request.Persists to DB.
Once Install is clicked then the Shopify shop details will be stored in the DB, and the user redirected to the Netcomm & eKomi Configuration Page to complete installation.
After the user has clicked the install button then Shopify sends a request to our callbackAction to register all the webhooks through a Curl request.
Important header information:Code Block curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'X-Shopify-Access-Token: ' . $accessToken, 'Accept: application/json', 'Content-Type: application/json' ]);