Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WooCommerce error #19

Open
marypieroszkiewicz opened this issue Jul 21, 2020 · 3 comments
Open

WooCommerce error #19

marypieroszkiewicz opened this issue Jul 21, 2020 · 3 comments

Comments

@marypieroszkiewicz
Copy link

Hi. I have a problem with the Stock API libphp on the site where the WooCommerce store is on Wordpress. There is such an error in the log:

Fatal error: Uncaught Exception: Client error: GET https://stock.adobe.io/Rest/Media/1/Search/Files?locale=pl_PL&search_parameters%5Bmedia_id%5D=171086334&search_parameters%5Blimit%5D=32&search_parameters%5Boffset%5D=0 resulted in a 401 Unauthorized response:
{"error_code":"401013","message":"Oauth token is not valid"}

in /home/midgart2/ftp/tapeko.pl/wp-content/themes/tapeko/vendor/astock/stock-api-libphp/src/Exception/StockApi.php on line 34

Website: https://tapeko.pl/produkt/fototapety/40957985/

Thank you for help.

@chfabbro
Copy link
Member

Hi Mary. Did you build the WooCommerce integration, or are you only using it? Adobe did not build the integration, but we did build the SDK.

The error you see is caused by a missing or invalid authentication token. In other words, you would need to sign into an Adobe service and the integration would need to use your access token. If you never signed in or if the token is expired or invalid, then you would get this error.

If you have not been made to sign into Stock, then this is likely a bug in the integration. FYI it is not necessary to sign in to use the Search API. The SDK allows you set the access token to null and it will use an unauthenticated search. If you are not the developer of this integration, then this should be opened as a bug for that team. Do you know if they have a GitHub project for their WooCommerce plugin?

@marypieroszkiewicz
Copy link
Author

marypieroszkiewicz commented Jul 22, 2020

Hello Christopher. Thank you for answer.

I didn't build anything, I got a website where an error pops up ... probably the website uses only SDK.

The website uses "Advanced Custom Field" where Adobe Stock photos are added to the collection.

In the console for this website, I created OAuth Web for this website

Screen: https://i.imgur.com/kSCVB2L.png

I added the generated OAuth to the AdobeConfig.php configuration file

Screen: https://i.imgur.com/iLjbdFV.png

and the error is still there. What should I do next so that the error does not appear. Thank you for your help.

@chfabbro
Copy link
Member

Hi Mary,

I recommend you start by looking at the OAuth workflow guide here:
https://github.com/adobe/stock-api-docs/blob/master/supplemental/Stock-Authorization-Code-Workflow.pdf

And also the sample code I created here:
https://github.com/adobe/stock-api-samples/tree/master/php/authcode-php

The configuration looks okay, but keep in the mind the SDK does not perform authentication. It assumes that you will be authenticating and creating an access token outside of the SDK. Adobe Stock is just one service, but authentication is provided by the Adobe IMS identity services, and must be integrated separately. My sample code shows you how to do that using only PHP and some open source libraries. Once you authorize and have a valid token, then the SDK is used with that token.

If you have further questions, it would be more efficient if you emailed them to stockapis@adobe.com, which is a mail list that I manage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants