错误:未被发现(在承诺中):对象:{; error" popup_closed_by_user;}

发布于 2025-02-11 00:48:12 字数 348 浏览 1 评论 0 原文

我正在尝试使用Angular 11与Ionic应用一起使用Google登录。但是我一直在收到错误错误:未接收到(在Promise):object:{“ error”:“ popup_closed_by_user”}

也在警告中,我正在接收”您创建了一个新的客户端应用程序,该应用程序将不再使用新客户库来进行用户身份验证或授权。 //developers.google.com/indesity/gsi/web/guides/gis-migration“ rel =“ nofollow noreferrer”>迁移指南有关更多信息。”

我还使用Angularx-Social-Login插件。

让我知道是否需要其他任何东西。需要帮助。

I am trying to use Google login with the ionic app using angular 11. but I am keep receiving the error Error: Uncaught (in promise): Object: {"error":"popup_closed_by_user"}

Also in the warnings, I am receiving "You have created a new client application that uses libraries for user authentication or authorization that will soon be deprecated. New clients must use the new libraries instead; existing clients must also migrate before these libraries are deprecated. See the Migration Guide for more information."

I am also using angularx-social-login plugin.

let me know if anything else is required. need help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掩耳倾听 2025-02-18 00:48:12

我还遇到了这个问题,并将“@abacritt/angularx-Social-login”用于社交媒体登录。此问题发生在所有新创建的Google客户端ID中。如果您使用的是Angular应用程序,则可以通过在提供商中添加“ plugin_name”来解决这。

在app.module.ts中,创建一个保存“ plugin_name”的对象。

const googleLoginOptions = {
  scope: 'profile email',
  plugin_name:'login' //you can use any name here
}; 

在提供商中,将“ GoogleLoginOptions”对象与Google客户端ID一起传递。

@NgModule({
 declarations: [
    AppComponent
    ],
  imports: [
    BrowserModule,
    NgbModule,
    AppRoutingModule,
    CommonModule,
    HttpClientModule,
    SocialLoginModule
  ],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
  providers: [
        {
          provide: 'SocialAuthServiceConfig',
          useValue: {
            autoLogin: false,
            providers: [
              {
                id: GoogleLoginProvider.PROVIDER_ID,
                provider: new GoogleLoginProvider(
                  'YOUR GOOGLE CLIENT_ID', 
                   googleLoginOptions
                )
              }
            ],
            onError: (err) => {
              console.error(err);
            }
          } as SocialAuthServiceConfig,
        }
  ],
  bootstrap: [AppComponent]
})

现在,清除浏览器缓存,应该可以正常工作。
有关app.component.ts的更改,您可以参考

此解决方案对我有用。希望这会有所帮助。

I also have encountered this issue and was using '@abacritt/angularx-social-login' for social media login. This issue happens for all the newly created Google Client IDs. This can be resolved by adding 'plugin_name' in the provider if you are using Angular application.

In app.module.ts, create an object which holds the 'plugin_name'.

const googleLoginOptions = {
  scope: 'profile email',
  plugin_name:'login' //you can use any name here
}; 

And in providers, pass the 'googleLoginOptions' object along with the google client ID.

@NgModule({
 declarations: [
    AppComponent
    ],
  imports: [
    BrowserModule,
    NgbModule,
    AppRoutingModule,
    CommonModule,
    HttpClientModule,
    SocialLoginModule
  ],
  schemas: [ CUSTOM_ELEMENTS_SCHEMA ],
  providers: [
        {
          provide: 'SocialAuthServiceConfig',
          useValue: {
            autoLogin: false,
            providers: [
              {
                id: GoogleLoginProvider.PROVIDER_ID,
                provider: new GoogleLoginProvider(
                  'YOUR GOOGLE CLIENT_ID', 
                   googleLoginOptions
                )
              }
            ],
            onError: (err) => {
              console.error(err);
            }
          } as SocialAuthServiceConfig,
        }
  ],
  bootstrap: [AppComponent]
})

Now, clear the browser cache and it should be working.
For the changes in app.component.ts you may refer to @abacritt/angularx-social-login- documentation

This solution worked for me. Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文