Android上的Firebase REST Auth返回500

时间:2017-06-09 15:55:24

标签: firebase xamarin firebase-authentication

直到上周,在使用Firebase.Xamarin所需的Xamarin.Android应用程序中使用Firebase的唯一合理路径(由于很多原因)。但是,这似乎也停止了。

具体来说,我已经能够在我的Android和iOS应用程序中成功进行以下调用并获得成功的回复:

var contentString = $"grant_type=refresh_token&code=string&refresh_token={auth.RefreshToken}";
var requestContent = new StringContent(contentString, Encoding.UTF8, "application/x-www-form-urlencoded");
var uri = new Uri(string.Format("https://securetoken.googleapis.com/v1/token?key={0}", this.authConfig.ApiKey));
var response = await client.PostAsync(uri, requestContent).ConfigureAwait(false);
var responseData = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

截至昨天,我开始从上面的代码中获取以下responseData

的iOS:

{
  "error": {
    "code": 403,
    "message": "Requests from this ios client application \u003cempty\u003e are blocked.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developer console API key",
            "url":     "https://console.developers.google.com/project/<my_apps_project_id>/apiui/credential"
          }
        ]
      }
    ]
  }
}

机器人:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "ipRefererBlocked",
    "message": "The request did not specify any Android package name or signing-certificate fingerprint. Please ensure that the client is sending them or use the API Console to update your key restrictions.",
    "extendedHelp": "https://console.developers.google.com/apis/credentials?project=<my_apps_project_id>"
   }
  ],
  "code": 403,
  "message": "The request did not specify any Android package name or signing-    certificate fingerprint. Please ensure that the client is sending them or use the API Console to update your key restrictions."
 }
}

经过一些调研后,我发现了this Google Cloud Endpoints Google Groups线程,该线程确保以下内容位于http请求的标题中:

Header x-android-package
Label servicecontrol.googleapis.com/android_cert_fingerprint

Header x-android-cert 
Label servicecontrol.googleapis.com/android_package_name

Header x-ios-bundle-identifier
Label servicecontrol.googleapis.com/ios_bundle_id

我在client.DefaultRequestHeaders.Add("X-Ios-Bundle-Identifier", <my_apps_bundle_id>);之前的代码中添加了client.PostAsync,它就像魅力一样。

转到Android,我在请求标头中添加了"x-android-cert"x-android-package

client.DefaultRequestHeaders.Add("x-android-cert", <my_apps_SHA1>);
client.DefaultRequestHeaders.Add("x-android-package", <my_apps_package_id>);
在我的client.PostAsync电话之前

。但是,现在我得到以下responseData:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "internalError",
    "message": "Internal Error"
   }
  ],
  "code": 500,
  "message": "Internal Error"
 }
}

一个发泄的时刻:对我来说,这几乎是Firebase的最后一根稻草。已经过了一个多月的时间,一个接一个地克服了一个未记录和半成品的API / SDK。似乎NOTHING的工作方式与广告一样(包括 - 关闭主题 - 让Firebase与Angular4项目一起工作)。谢谢你让我分享我的沮丧。如果我知道这将是多么痛苦,我会建立自己的MBaaS。

在我放弃Firebase之前,我想就此问题寻求帮助。任何见解和帮助将不胜感激。

编辑1:* 通过以下更改我得到了类似的结果:

 var requestContent = new StringContent(postContent, Encoding.UTF8, "application/json");
 var uri = new Uri(string.Format("https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyAssertion?key={0}", this.authConfig.ApiKey));

0 个答案:

没有答案