离子2:使用谷歌+登录在浏览器中工作,但不在智能手机中

时间:2016-10-10 19:31:34

标签: angular ionic-framework ionic2 ionic-view ionicpopup

我成功登录google +进入我的应用程序。 当我运行我的应用程序时,我在chrome \ explorer中检查它,它工作正常, 但当我检查我的智能手机或Android的模拟器时,它显示我登录成功的烤面包机(弹出)但它保持在登录的同一页面而没有做任何事情。(这只是当我按下登录时使用谷歌+)。

此外,当我按下登录时显示无效的详细信息时,它会显示图标加载并且卡住了。

这是我的代码: app.module.ts => app.module.ts code

app.component.ts => app.component.ts

这是我的服务提供商代码:service ts code

这是我的登录页面代码:login.ts

loading while invalid login details- loading without shows any error pop up of user\password not correct and it stuck while press on google+ shows user successful but without enter to home page--> in browser it's works fine.

智能手机中的照片

第一张照片: 加载时无效的登录详细信息 - 加载时没有显示任何错误弹出用户\密码不正确而且卡住了

第二张照片:按下谷歌+显示用户成功但没有进入主页 - >在浏览器中,它可以正常工作。

1 个答案:

答案 0 :(得分:0)

我认为你不能在Ionic / Cordova应用程序中使用signInWithPopup()signInWithRedirect(),或者至少还没有。

您需要的解决方法是使用Mike

Ionic Blog所述的Google cordova插件

您使用该插件获取登录凭据,然后将这些凭据传递给Firebase的signInWithCredential()方法,并对您进行身份验证。