Google提供商使用Firebase和Ionic登录

时间:2021-10-02 04:47:08

I have been trying to create an Ionic Google login popup with Firebase. However, when the user tries to press the login button, the function is called producing a popup that is surprisingly completely blank.

我一直在尝试使用Firebase创建一个Ionic Google登录弹出窗口。但是,当用户尝试按下登录按钮时,会调用该函数,生成一个令人惊讶的完全空白的弹出窗口。

$scope.login = function()
{

        baseRef.authWithOAuthPopup("google", function(error, authData) 
        {

            if (error)
            {
                alert('Hello');
            }

            else 
            {
                $scope.auth = authData.google;
                $scope.user.set("name", $scope.auth.displayName);
                $scope.user.set("image", $scope.auth.profileImageURL)
                $scope.user.save();
            }

        });

};

All my permissions in Firebase and Google have been properly set as well as those in the config file. Does anyone have any idea how I can possibly fix this issue to allow a functional popup to spawn?

我在Firebase和Google中的所有权限都已正确设置,以及配置文件中的权限。有没有人知道我怎么可能解决这个问题,以允许功能弹出产生?

1 个解决方案

#1


0  

I had quite a problem with this also. It appears to work well with iOS, but no luck with android.

我也遇到了这个问题。它似乎适用于iOS,但没有运气与android。

By using the command 'ionic state save' followed by 'ionic state restore' ionic readded the android and iOS platforms. It also added cordova-plugin-inappbrowser, cordova-plugin-whitelist (plugins) to the package.json file.

通过使用命令'离子状态保存',然后'离子状态恢复'离子读取android和iOS平台。它还在package.json文件中添加了cordova-plugin-inappbrowser,cordova-plugin-whitelist(插件)。

Next, I created an android build using 'ionic package build android' and send it to my OnePlus 2 using TestFairy.

接下来,我使用'ionic package build android'创建了一个android构建,并使用TestFairy将其发送到我的OnePlus 2。

Finally works, for both google and facebook.

最后适用于谷歌和脸书。

In summary once the package.json file included the relevant plugins, I was able to create an APK file that worked with the firebase $authWithOAuthPopup.

总之,一旦package.json文件包含相关插件,我就能够创建一个与firebase $ authWithOAuthPopup一起使用的APK文件。

(with these amendments, iOS still seems to work fine)

(通过这些修改,iOS似乎仍能正常工作)

#1


0  

I had quite a problem with this also. It appears to work well with iOS, but no luck with android.

我也遇到了这个问题。它似乎适用于iOS,但没有运气与android。

By using the command 'ionic state save' followed by 'ionic state restore' ionic readded the android and iOS platforms. It also added cordova-plugin-inappbrowser, cordova-plugin-whitelist (plugins) to the package.json file.

通过使用命令'离子状态保存',然后'离子状态恢复'离子读取android和iOS平台。它还在package.json文件中添加了cordova-plugin-inappbrowser,cordova-plugin-whitelist(插件)。

Next, I created an android build using 'ionic package build android' and send it to my OnePlus 2 using TestFairy.

接下来,我使用'ionic package build android'创建了一个android构建,并使用TestFairy将其发送到我的OnePlus 2。

Finally works, for both google and facebook.

最后适用于谷歌和脸书。

In summary once the package.json file included the relevant plugins, I was able to create an APK file that worked with the firebase $authWithOAuthPopup.

总之,一旦package.json文件包含相关插件,我就能够创建一个与firebase $ authWithOAuthPopup一起使用的APK文件。

(with these amendments, iOS still seems to work fine)

(通过这些修改,iOS似乎仍能正常工作)