Phonegap Cordova使用Facebook登录

时间:2019-02-28 20:41:51

标签: android cordova facebook-javascript-sdk phonegap-plugins phonegap

我是Phonegap的新手,我想在我的Cordova应用程序中添加Facebook登录,我尝试了Java插件和Facebook SDK。

插件:https://github.com/jeduan/cordova-plugin-facebook4

Facebook JavaScript SDK:https://developers.facebook.com/docs/facebook-login/web

在sdk和javascript插件中,我都遇到了困难。

插件:

The key hash does not match any stored key hashes

Facebook SDK JS:

Unable to load URL: The domain for this URL is not included in the application domains. In order to load this URL, add all domains and subdomains to the Application Domains field in the application settings.

我尝试将localhost添加为我的域,但不起作用,并尝试在Windows中创建哈希,我生成了哈希并将其添加到我的facebook应用中,但仍然出现相同的错误。

有人知道吗?

<!--Version Phonegap-->
<preference name="cordova-ios" version="4.5.4" />
<preference name="phonegap-version" value="cli-8.0.0" />

Facebook插件config.xml:

<plugin name="cordova-plugin-facebook4" spec="~4.2.1">
    <variable name="APP_ID" value="XXXXXXXXX" />
    <variable name="APP_NAME" value="YYYYYY" />
</plugin>

Facebook插件登录:

const permissions = new Array("email","public_profile");

        facebookConnectPlugin.login(permissions, function (userData) {
            console.log("UserInfo: ", userData);
        },
          function loginError(error) {
            console.error(error)
          }
        );

Facebook SDK JS:

FB.login(function (response) {
            if (response.status === 'connected') {
                // Logged into your app and Facebook.
            } else {
                // The person is not logged into this app or we are unable to tell. 
            }
        });

1 个答案:

答案 0 :(得分:0)

我找到了解决方法:

df.pivot_table(columns='one', index=df.index//len(df), values='two').rename_axis(None, axis=1)

#or with pivot
df = df.pivot(columns='one', index=df.index//len(df)).rename_axis([None, None], axis=1)
df.columns = [y for _,y in df.columns]

    a   b   c
0  12  32  12

我将我的Facebook应用设置为Android平台,并使用(config.xml)设置程序包名称:

  c_canvas.width  = 501;
  c_canvas.height = 381; 

还有我的班级名称,我跟随this,并使用http://www.javadecompilers.com/result

要生成我的哈希,请遵循Muhammad Omar ElShourbagy solution

一切正常。