Google云端硬盘中的重定向网址无效

时间:2013-12-03 03:41:34

标签: google-drive-api google-oauth

当我在Google云端硬盘重定向网址中输入http://mydomain.com,然后获取:

  

无效的重定向网址

请告诉我这是什么问题?

1 个答案:

答案 0 :(得分:1)

我指的是控制台,您可以在其中创建并获取项目的密钥:

https://cloud.google.com/console

您对localhost的URL是“Redirect URIs”

在您的代码中,您有:

$redirectURI = 'http://localhost';

$client = new Google_Client();
// Get your credentials from the console
$client->setClientId($clientID);
$client->setClientSecret($clientSecret);
$client->setRedirectUri($redirectURI);
$client->setScopes(array('https://www.googleapis.com/auth/drive.file'));

这些必须匹配,否则每次都会出现此错误。

相关问题