GDrive google-api-php-client- 不认证
GDrive google-api-php-client- Do not authenticate
我已经尝试了下面的 URL
,但没有转到 Google 请求权限页面,因此不获取代码。
https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://Adhym.staging.abc.com/wp-content/plugins/SFMarketo/google-api-php-client/gDrive_access/roi_results_upload.php&client_id=xxx&scope=https://www.googleapis.com/auth/drive&access_type=offline&approval_prompt=auto
但是如果 return URL
更改为本地主机 - 如下 - 它按预期工作正常。
https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://localhost:2345/wordpress/wp-content/plugins/SFMarketo/google-api-php-client/gDrive_access/roi_results_upload.php&client_id=xxx&scope=https://www.googleapis.com/auth/drive&access_type=offline&approval_prompt=auto
根据我的个人经验,我前段时间遇到了同样的问题,我发现我的项目凭证的 "Authorized redirect URIs" 部分中没有包含 URL。
请转至 console.developers.google.com,select 您的项目,转至凭据,select 客户端 ID,您将看到与此类似的屏幕
Credentials
确保您使用的是正确的 ClientID 网站。一种检查方法是为 Authorized JavaScript origins 和 [=20= 创建一个没有任何限制的客户端 ID ]授权的重定向 URI 或两者。您可能使用了只有 localhost 有权调用请求的 ClientID。
In the Authorized JavaScript origins field, enter the origin for your app. You can enter multiple origins to allow for your app to run on different protocols, domains, or subdomains. You cannot use wildcards. In the example below, the second URL could be a production URL.
http://localhost:8080
https://myproductionurl.example.com
此外,它可以帮助您记录错误或打开 DevTool 以有效地跟踪布局问题、设置 JavaScript 断点并获得代码优化的见解。
希望对您有所帮助!
我找到了问题的原因临时服务器中有文件访问权限。
在登台服务器中将所需权限授予令牌文件(从 Google 请求权限页面接收)所在的文件夹位置解决了我的问题。
我已经尝试了下面的 URL
,但没有转到 Google 请求权限页面,因此不获取代码。
https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://Adhym.staging.abc.com/wp-content/plugins/SFMarketo/google-api-php-client/gDrive_access/roi_results_upload.php&client_id=xxx&scope=https://www.googleapis.com/auth/drive&access_type=offline&approval_prompt=auto
但是如果 return URL
更改为本地主机 - 如下 - 它按预期工作正常。
https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=http://localhost:2345/wordpress/wp-content/plugins/SFMarketo/google-api-php-client/gDrive_access/roi_results_upload.php&client_id=xxx&scope=https://www.googleapis.com/auth/drive&access_type=offline&approval_prompt=auto
根据我的个人经验,我前段时间遇到了同样的问题,我发现我的项目凭证的 "Authorized redirect URIs" 部分中没有包含 URL。
请转至 console.developers.google.com,select 您的项目,转至凭据,select 客户端 ID,您将看到与此类似的屏幕 Credentials
确保您使用的是正确的 ClientID 网站。一种检查方法是为 Authorized JavaScript origins 和 [=20= 创建一个没有任何限制的客户端 ID ]授权的重定向 URI 或两者。您可能使用了只有 localhost 有权调用请求的 ClientID。
In the Authorized JavaScript origins field, enter the origin for your app. You can enter multiple origins to allow for your app to run on different protocols, domains, or subdomains. You cannot use wildcards. In the example below, the second URL could be a production URL.
http://localhost:8080
https://myproductionurl.example.com
此外,它可以帮助您记录错误或打开 DevTool 以有效地跟踪布局问题、设置 JavaScript 断点并获得代码优化的见解。
希望对您有所帮助!
我找到了问题的原因临时服务器中有文件访问权限。
在登台服务器中将所需权限授予令牌文件(从 Google 请求权限页面接收)所在的文件夹位置解决了我的问题。