【问题标题】:BigCommerce - Hello World App - Callback URLsBigCommerce - Hello World 应用程序 - 回调 URL
【发布时间】:2016-12-17 08:05:05
【问题描述】:

我正在尝试从bigcommerce/hello-world-app-php-silex 安装 BigCommerce Hello World 应用程序。当我尝试在试用商店中安装应用程序时,它会显示应用程序文件夹的索引。 .

我认为这与回调 URL 有关。

这里的说明不清楚要输入什么,所以我输入了:

index.php 位于 bigcommerce/hello-world-app-php-silex

我应该为回调 URL 输入什么?

另外,这是我在 .env 文件中为环境变量输入的内容。
BC_AUTH_SERVICE 和 BC_CALLBACK_URL

更新:好的,我能够让 index.php 默认加载。
在 Apache24/conf/httpd.conf 中,我将“AllowOverride None”更改为“AllowOverride FileInfo”,取消注释“LoadModule rewrite_module modules/mod_rewrite.so”,在.htaccess 文件中,在项目的根目录中,我删除了“ /” 继续 index.php 所以它现在说“RewriteRule ^(.*)$ index.php/$1 [L]”。由于项目不在根目录中,需要删除“/”。

现在我得到两个错误。看起来这个项目是写在根目录下的,所以我把它放在根目录下,把“/”放回.htaccess中,更新了URL,我仍然得到同样的两个错误。

【问题讨论】:

  • 为什么怀疑回调 URL 是问题的原因?问题是您的 Web 服务器未配置为执行 PHP 文件。无论如何,您需要将 localhost 替换为服务器的 DNS 名称或 IP 地址,以便客户端可以访问它。
  • @CodeCaster 我用一个使用 curl 身份验证的测试 .php 文件测试了 Web 服务器,所以我知道它可以工作。另外,我正在尝试将它安装在我的试用商店中,从我的计算机上安装我的网络服务器,本地主机工作正常。
  • 您看到包含index.php 文件的目录列表这一事实证明您的Web 服务器(至少对于该目录)未设置为执行PHP 文件。
  • 当我直接进入 localhost 时,它显示“It works!”这就是 index.php 中的内容。
  • 。 . .但我明白你在说什么。如果它适用于 localhost,为什么它不适用于 localhost/bigcommerce/hello-world-app-php-silex?

标签: bigcommerce


【解决方案1】:

我会这么多次,我会使用每一种可能性,但错误没有解决,让我知道你是如何解决这个错误的。

https://i.stack.imgur.com/9nLKu.jpg

Here My .env file : 
BC_AUTH_SERVICE=https://login.bigcommerce.com
BC_CLIENT_ID=My client id
BC_CLIENT_SECRET=My secret id
BC_CALLBACK_URL=https://localhost/bigcommerce/callback/load

Here My Server path in dev tools file: 
Auth Callback URL - more info 
https://localhost/bigcommerce/callback
Load Callback URL - more info 
https://localhost/bigcommerce/load
Uninstall Callback URL - more info 
https:/localhost/bigcommerce/uninstall

Let me folder structure of Silex 
My localhost is Right now [ HTTPS ]  : https://localhost/bigcommerce/index.php

【讨论】:

    【解决方案2】:

    回调 URL 需要包含 /load 和 /auth/callback 的路径。

    它们不是文件夹的路径,而是资源的路径。这就是错误是 ResourceNotFound 的原因。

    .env 中的回调 URL 需要是:
    BC_CALLBACK_URL=https://localhost/auth/callback

    【讨论】:

      【解决方案3】:

      使用此代码在您的项目根目录中添加 .htaccess

      RewriteEngine on
      #RewriteBase /
      
      # only rewrite if the requested file doesn't exist
      RewriteCond %{REQUEST_FILENAME} !-s
      
      # pass the rest of the request into index.php to handle
      RewriteRule ^(.*)$ /index.php/$1 [L]
      
      # Prevent the web from seeing the readme.md just to be safe
      RewriteRule ^README\.MD$ - [L,F]
      

      【讨论】:

      • 不要转储代码。解释 OP 的问题并解释你的答案如何解决这个问题。
      • 根目录中有一个 .htaccess 文件,其中包含确切的内容。
      猜你喜欢
      • 1970-01-01
      • 2017-05-03
      • 1970-01-01
      • 1970-01-01
      • 2017-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-16
      相关资源
      最近更新 更多