FosterCommerce / shipstation-connect

A plugin for Craft Commerce 2 that integrates with ShipStation.
https://plugins.craftcms.com/shipstationconnect
Other
7 stars 10 forks source link

Getting 403 connecting to Custom Store on Laravel Forge #57

Closed Lab385 closed 8 months ago

Lab385 commented 8 months ago

As Laravel Forge runs Nginx I wonder if it's not passing the auth, so tried adding this to location in nginx conf but to no effect:

proxy_set_header Authorization $http_authorization;
proxy_pass_header  Authorization;
johnnynotsolucky commented 8 months ago

@Lab385 could you provide some more information so we can investigate the issue more thoroughly:

Could you also confirm

The plugin doesn't output an HTTP 403. If the username/password combination is incorrect you should see an HTTP 401 response instead.

A request such as the following can be used to test whether exports work correctly:

curl --location 'https://<your host>/actions/shipstationconnect/orders/process?action=export' \
  --header 'Authorization: Basic <username:password>'

The authorization header value is a base64 encoded string of username:password.

Lab385 commented 8 months ago

Hi @johnnynotsolucky

Craft Pro 4.5.9 Craft Commerce 4.3.1 ShipStation Connect 2.0.3

Yes, I’ve copied the link straight out of the Shipstation Connect plugin and the curl returns a list of orders.

On 25 Oct 2023 at 4:42:11 pm, Tyrone Tudehope @.***> wrote:

@Lab385 https://github.com/Lab385 could you provide some more information so we can investigate the issue more thoroughly:

  • Version of Craft
  • Version of Craft Commerce
  • Version of this plugin

Could you also confirm

  • that the URL you've captured in "URL to Custom XML Page" on the ShipStation custom store form matches the URL provided by the plugin in the plugins settings page
  • and, that you can make a request to the export endpoint

The plugin doesn't output an HTTP 403. If the username/password combination is incorrect you should see an HTTP 401 response instead.

A request such as the following can be used to test whether exports work correctly:

curl --location 'https:///actions/shipstationconnect/orders/process?action=export' \ --header 'Authorization: Basic '

The authorization header value is a base64 encoded string of username:password.

— Reply to this email directly, view it on GitHub https://github.com/FosterCommerce/shipstation-connect/issues/57#issuecomment-1778791412, or unsubscribe https://github.com/notifications/unsubscribe-auth/BDPVUXDRGJPUWOZBKT56HHTYBDGGHAVCNFSM6AAAAAA6NK6BXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZYG44TCNBRGI . You are receiving this because you were mentioned.Message ID: @.***>

johnnynotsolucky commented 8 months ago

@Lab385 it seems like the problem lies somewhere between your site and ShipStation. You'll need to figure out where the fault is.

As a first step, you can confirm that ShipStations requests are indeed reaching your server:

In Laravel Forge, you can view nginx logs by

Attempt to create the connection in ShipStation, refresh the access log and verify that a new access log appears. If it errored, you should still see the log, but with an error HTTP code. Then you can have a look at the error log for potential causes.

I'm going to close this for now because it looks like it's not a problem caused by the plugin directly.

However, please reach out to me on the Craft Discord, I have the same handle as on Github, and I can assist further.

terryupton commented 2 months ago

Did you manage to resolve this @Lab385 as I am seeing the same issue.

Lab385 commented 2 months ago

Did you manage to resolve this @Lab385 as I am seeing the same issue.

@terryupton it was an issue with the actual Shipstation account, from what we could see. I created a new test account, the integration worked fine, so we moved everything across.

johnnynotsolucky commented 2 months ago

@terryupton what specific issue are you seeing?

The steps in the comment above should help you diagnose where the problem lies.

terryupton commented 2 months ago

Hey @johnnynotsolucky and @Lab385 - thanks for the replies. I managed to resolve this by adding the .htaccess file with the following:

CGIPassAuth On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]