php-shopify
php-shopify copied to clipboard
Authentication Validation
Hello,
I'm currently facing an issue to which I haven't found an answer to, it is related to the authentication.
I do not get any response when I do an authentication, so whether it worked or failed I cannot know until I see bugs later on in my code. That's not so bad while testing but will become quite problematic in operation if I can't detect the success or failure of that step.
Is there any way to actually know if the authentication succeeded and if yes how? Am very new to programming so might have missed something obvious for others here.
Any help would be welcome, thanks.
@SebastienPoncelet I am not sure which authentication you mean. I assume it to be Oauth Authentication. Can you elaborate a bit more, which issue you are facing and in what way you want it to be handled?
@tareqtms Sorry for the delay.
I'm using URL authentication with tokens, trying to use the access token as explained on that page, section "Shopify access token". https://shopify.dev/tutorials/authenticate-a-private-app-with-shopify-admin#make-authenticated-requests
Have tried a few ways to include the access token in the headers but haven't managed it.
How can I include the access token in the header using the SDK?
@SebastienPoncelet It's as simple as this:
$config = array(
'ShopUrl' => 'yourshop.myshopify.com',
'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
);
$shopify = new PHPShopify\ShopifySDK($config);
Please check the full documentation for the SDK in the README page. It will help a lot!
Have tried it that way, but it doesn't seem to work. Cannot create a FulfillmentService this way.
Your problem was with authentication. Does the authentication work now?
Ok, the authentication with the access token does not work in my case. I know that because when I try to create a FulfillmentService, which requires that type of authentication, it does not create it .
When I insert the same access token in Postman's header, with the same json in the request and it creates it. This is why I believe that the authentication as you mentioned does not work.