2019-09-18 08:58
浏览 42

DefaultClient范围从App Engine(Go)1.9迁移到1.11

I've recently been migrating an App Engine (Go) app from Go 1.9 to 1.11. I've followed the steps in the Migrating your App Engine app from Go 1.9 to Go 1.11 document, excluding the optional ones. I plan on doing the optional tasks later once I get this working.

I get the app to build and I can deploy it just fine. Most of everything works fine, with the exception of one API that is used to look up some info on a Google Play IAP. When I do that, I get the following error:

Error 403: Insufficient Permission: Request had insufficient authentication scopes., insufficientPermissions

I've checked, and the scope that I'm using is, which is still the scope listed in the Google Play Developer API documentation.

I'm using the App Engine default service account for the client by calling DefaultClient from the library, which returns a client without an error

When I test the same code with Go 1.9, there are no authentication issues at all, and the API works. I'm guessing that these is something in the authentication setup which has changed but I can't find any documentation on it, nor on what I should do differently.

I have to imagine that a lot of people have had to do this migration, and I can't find any posts with this problem, so I'm lost as to why I'm getting it.

图片转代码服务由CSDN问答提供 功能建议

我最近一直在将App Engine(Go)应用程序从Go 1.9迁移到1.11。 我已按照 从以下位置迁移App Engine应用程序中的步骤进行操作 将1.9转到1.11 文档,不包括可选文档。 我计划在工作后再执行可选任务。

我可以构建应用,并且可以很好地进行部署。 除了用于在Google Play IAP上查找某些信息的一个API之外,大多数其他工具都可以正常工作。 这样做时,出现以下错误:


我已经检查过,并且我正在使用的范围是 ,该范围仍然是 Google Play开发者API文档

我正在通过 库中的 DefaultClient 来为客户端使用App Engine默认服务帐户 ,它将返回没有错误的客户端

当我使用Go 1.9测试相同的代码时,根本没有身份验证问题,并且该API可以正常工作。 我猜想这是身份验证设置中发生的一些更改,但是我找不到有关它的文档,也找不到我应该做的不同的事情。

我必须想象一下 很多人不得不进行此迁移,而我找不到任何与此问题相关的帖子,所以我迷失了为什么要得到它。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • du13520157325 2019-09-18 09:48

    I think the issue is in the differences of runtime in Go 1.9 and 1.11. It doesn't seem to allow you to use Application Default Credentials anymore, you have to set them via a JSON file in 1.11. I found someone who had a very similar issue to you and they used a workaround by uploading a key and using that to get a Client.

    Have a look here

    Let me know.

    点赞 打赏 评论

相关推荐 更多相似问题