1

我正在开发一个使用 ASP.NET 检索 Google Drive 文档列表的项目,但出现错误:

发生错误:已超出 Google.Apis.Requests.RequestError 未经身份验证使用的每日限制。继续使用需要注册。[403]

这是我的网站(在此链接上出现错误): http: //www.netdesklive.com/

我正在为此尝试 DrEdit 代码,但无法正常工作。

我根据https://developers.google.com/drive/examples/dotnet设置了所有凭据,但仍然出现错误

所以请给我建议

代码 :

-> 我在状态和代码中得到空值

public ActionResult Index(string state, string code)
{
    try
    {
        IAuthenticator authenticator = Utils.GetCredentials(code, state);
        // Store the authenticator and the authorized service in session
        Session["authenticator"] = authenticator;
        Session["service"] = Utils.BuildService(authenticator);
    }
    catch (CodeExchangeException)
    {
        if (Session["service"] == null || Session["authenticator"] == null)
        {
            Response.Redirect(Utils.GetAuthorizationUrl("", state));
        }
    }
    catch (NoRefreshTokenException e)
    {
        Response.Redirect(e.AuthorizationUrl);
    }

    DriveState driveState = new DriveState();

    if (!string.IsNullOrEmpty(state))
    {
        JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
        driveState = jsonSerializer.Deserialize<DriveState>(state);
    }

    if (driveState.action == "open")
    {
        return OpenWith(driveState);
    }
    else
    {
        return CreateNew(driveState);
    }
}
4

1 回答 1

0

您的错误消息表明您的请求未经授权。您应该使用 Oauth2 授权他们:

于 2012-11-30T09:21:23.197 回答