skygdi/shopify-private-app-foundation

There is no license information available for the latest version (dev-main) of this package.

A Shopify private APP skeleton, install and use the Shopiy Admin API token

dev-main 2021-05-19 04:09 UTC

This package is auto-updated.

Last update: 2024-04-19 10:31:13 UTC


README

Setup:

Install:

composer require skygdi/shopify-private-app-foundation

APP Setup:

Allowed redirection URL(s):

https://your-app.ngrok.io/install
https://your-app.ngrok.io/install_authorize

Modify your .env:

SHOPIFY_APP_API_KEY="APP_key"
SHOPIFY_APP_API_SECRET="APP_secret"
SHOPIFY_APP_API_SCOPES="read_products,read_product_listings,read_themes,write_themes,read_script_tags,write_script_tags"

build your logic controller:

The entry URL is "/". So, you need to define this route on your own.
use Skygdi\ShopifyPrivateAPPFoundation\Traits\ShopifyInstallTrait;
class HomeController extends Controller
{
  use ShopifyInstallTrait; //Add
  function entry(Request $request){
    if( !$this->hashCheck($request) ) abort(403,"No Access Token Found");
    //Hash check success, means it came from Shopify APP.
    //Build your login code from here
    //Auth::loginUsingId(1); //Like login a user or an admin backend.
    //return redirect()->to('/admin');
  }
}

Update the session for Shopify frame

config/session.php
'secure'	=> true
'same_site'	=> 'none'

Usage:

Communicate with API token:

$this->loadShopDomain();
$this->loadAccessToken();
//Do your REST API call