首页 > 解决方案 > 从 Google 驱动器身份验证重定向后不可接受的链接

问题描述

这是我的身份验证代码,

$client = new Google_Client();
$client->setApplicationName('Google Drive API PHP Quickstart');
$client->setRedirectUri("https://example.com/google_redirect");
$client->setClientId("my-client-id");
$client->setClientSecret("my-client-secret");
$client->setScopes(Google_Service_Drive::DRIVE);
$client->setAccessType('offline');
$client->setPrompt('select_account consent');

我可以与此联系。但是从谷歌授权后,它的重定向是这样的,

https://example.com/google_redirect?code=4%2F0AY0e_i_have_changed_some_code_for_security_reason_6_d83BTJiyKKIHFsCb8l61xW71kyOPW3g&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive#

该页面显示此消息:

在此处输入图像描述

我想,我可以通过应用此处的任何内容来修复此错误消息:不可接受!在此服务器上找不到所请求资源的适当表示。此错误是由 Mod_Security 生成的

但这不是方便的方法。每个用户都应该这样做。

是否有任何特殊参数或其他东西可以防止这种情况或通过 Google 中的 POST 方法获取数据?

寻求帮助。提前致谢。

标签: phpgoogle-drive-api

解决方案


推荐阅读