Multi-pass passing token but get error

digitalmagic888
New Member
1 0 0

Greetings Shopify community!

Per following this doc: https://shopify.dev/docs/admin-api/rest/reference/plus/multipass  

I've got a custom php site passing thru token but not able to successfully verify/validate if customer exists on shopify side. 

See code snippet below:

try{
$ipAddress = $_SERVER['REMOTE_ADDR'];
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
$ipAddress = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
}
$customer_first_name = 'test';
$customer_last_name = 'test';
$customer_data = array(
"email" => $emailid,
"first_name" => $customer_first_name,
"last_name" => $customer_last_name,
"password" => (isset($_REQUEST['password'])) ? $_REQUEST['password'] : '123123123',
"remote_ip" => $ipAddress
);
$multipass = new ShopifyMultipass('MULTI-PASS-UNIQUE-TOKEN');
$token = $multipass->generate_token($customer_data);
$url = "https://yourshopify.myshopify.com/account/login/multipass/".$token;
header('Location: '.$url);
exit();
} catch (\Exception $ex) {
$errormsg = $ex->getMessage();
echo json_encode(array('status'=>'false','message'=>$errormsg));
exit();
}

 

Any help would be immensely appreciated! I've also checked out https://shopify.dev/tutorials/update-customer-data-with-storefront-api#customeraccesstokencreate but not sure if it will work better than multi-pass.  Looking forward to a response. 

0 Likes