• Resolved AskinSavascisi

    (@askinsavascisi)


    Hi,

    I’m trying to integrate woocommerce api in my laravel project, i dont want to manually get consumer secret so im trying to get those via Application Authentication Endpoint.

    it redirects me , and i need to login but after logging in im getting a 401 unauthorized error with following body:

    Error: An error occurred during the application and it was impossible to send the consumer data.

    i cant find anything on woocommerce logs.. tried deleting cookies, different browser, i’ve also tried to disabling all plugins except for woocommerce and going back to a default wordpress theme

    Kind regards,

    Askin

    $store_url = 'https://www.mystore.be';
    
    $endpoint = '/wc-auth/v1/authorize';
    
    $params = [
    
    'app_name' => 'MyApp',
    
    'scope' => 'read_write',
    
    'user_id' => 5,
    
    'return_url' => 'https://app.myapp.be/sales-channels/woocommerce/return', //GET Route
    
    'callback_url' => 'https://app.myapp.be/sales-channels/woocommerce/callback' //POST Route
    
    ];
    
    $query_string = http_build_query($params);
    
    return redirect()->away($store_url . $endpoint . '?' . $query_string);
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @askinsavascisi,

    The 401 error you’re encountering usually happens when the server cannot verify that you are authorized to access the endpoint specified. It seems like there might be an issue with your authentication process.

    Here are a few steps to troubleshoot:

    1. Ensure that the consumer key and consumer secret you are using are correct. If there’s a typo or error, it could lead to a 401 error.
    2. Make sure the user associated with the API credentials has the correct permissions to access the resources you’re trying to reach. More info: https://woo.com/document/woocommerce-rest-api/#section-8
    3. Ensure your site has a valid SSL certificate. WooCommerce REST API uses OAuth1.0a, which requires your site to be served over HTTPS.

    More info: https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication

    If you have checked all these and the issue persists, we recommend asking development questions on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question. You can also seek help from the following:

    I wish I could help more, but hopefully, this gets you going in the right direction to get some further insight/information.

    Thread Starter AskinSavascisi

    (@askinsavascisi)

    Hi,
    indeed, i’m familiar with a 401.. but the documentation is very bad…. ive done everything what’s written there..


    Slack

    “This link is no longer active

    To join this workspace, you’ll need to ask the person who originally invited you for a new link.”

    Plugin Support Beauty of Code (woo-hc)

    (@beautyofcode)

    Hey there ??

    Hmm, it looks like the Slack link is working as expected on my end:

    Can you please try using a different browser, or incognito/private mode and see if this makes any difference?

    Cheers!

    Thread Starter AskinSavascisi

    (@askinsavascisi)

    Hi,

    can you also post a ss after you’ve clicked on “let’s go” ? ?? you’ll see what i mean..

    Kind regards,

    Askin

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @askinsavascisi,

    When I click on the “Let’s Go” button, it redirects me perfectly to the Slack login page. I don’t encounter any issues.

    However, if you are still having issues, you may also try this link: https://join.slack.com/t/woocommercecommunity/shared_invite/zt-2chr78gc7-oGdKR2qLPHAq3djZJvsgkw (If this invites expired, please use the link shared earlier.)

    Let us know how that goes.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Woocommerce Api 401 – Application Authentication Endpoint’ is closed to new replies.