[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$f24TdVFyxRSHLdoi224ffyTlYrLRYyrC6qAzk0tk-ogw":3},{"code":4,"message":5,"data":6},200,"成功",{"id":7,"createdAt":8,"title":9,"content":10,"summary":11,"image":12,"uid":13,"user":14,"categoryId":21,"category":22,"subCategoryId":24,"subCategory":25,"comments":27,"status":17,"reason":28,"notice":28,"visitCount":29,"commentCount":30,"keywords":31},142,"2024-12-02T03:02:55.368Z","FirebaseError: Firebase: Invalid Idp Response: the Google id_token is not allowed to be used with this application. ..","## 一、前言\n在集成firebase来实现Google的授权登录时，有一种场景可能会导致Google授权失败，这篇文章来分享一下我遇到的这个问题。\n\n问题：\n> FirebaseError: Firebase: Invalid Idp Response: the Google id_token is not allowed to be used with this application. Its audience (OAuth 2.0 client ID) is 99914531xxxx-bbbvcr84fckm6is00it6igep9e0vkk57.apps.googleusercontent.com, which is not authorized to be used in the project with project_number: 48135841xxxx. (auth/invalid-credential).\n\n在我的上一篇文章 [https://www.xinwei.ltd/article/141](https://www.xinwei.ltd/article/141) 中，我已经分享了集成firebase的google授权登录的方法，但是可能会有人遇到上面的这个问题。\n\n出现问题的原因，是在于firebase是否自动在开发者的Google console中创建了client ID。另外还有一种情况是，如果开发者自己在Google console平台上新建了多个平台的app，然后这多个平台的app使用同一个firebase的情况下，会出现上面的这个问题。\n\n解决这个问题的方法很简单，就是需要在firebase的Google授权登录配置的地方，新增一个client ID，我截图给大家说明一下。\n\n## 二、解决方案\n### 2.1 firebase console中配置\n如下截图所示，firebase的控制台中已经提供了可以额外添加client ID的地方，这个地方是允许我们加入Google console平台上的client id的，在截图所载位置的地方加上client ID，并且保存后，Google console平台上的app就可以使用这个firebase项目的授权登录了。\n![firebase console](https://image.xinwei.ltd/image1733108254550.png)\n\n如果大家对这个步骤比较迷惑，建议阅读我之前的文章：[https://www.xinwei.ltd/article/141](https://www.xinwei.ltd/article/141)\n\n### 2.2 google console中的client ID\n![google console client id](https://image.xinwei.ltd/image1733108482069.png)\n如截图所示，这里的client id，就是需要复制粘贴到firebase console中的值，按照这个序号操作，你就可以看到这个client id，然后根据我上面给出的文章链接，就可以解决这个问题。\n\n希望对大家有帮助。\n\n\n","在集成firebase来实现Google的授权登录时，有一种场景可能会导致Google授权失败，这篇文章来分享一下我遇到的这个问题。","https://image.xinwei.ltd/image1733108254550.png",499668042977349,{"phone":15,"userId":13,"nickName":16,"vipType":17,"avatar":18,"sign":19,"createdAt":20},"13121171998","全栈老韩",1,"https://image.xinwei.ltd/images/IMG_5430.JPG","全栈工程师，擅长iOS App开发、前端（vue、react、nuxt、小程序&Taro）开发、Flutter、React Native、后端（midwayjs、golang、express、koa）开发、docker容器、seo优化等。","2024-01-01T16:14:30.305Z",2,{"id":21,"name":23},"IT技术",32,{"id":24,"name":26,"parentId":21},"前端",[],"",80,0,"FirebaseError,google id_token,Invalid Idp Response,Google id_token is not allowed to be used,OAuth 2.0 client ID,googleusercontent.com,firebase集成,google集成,谷歌授权登录"]