我想为我的 php 应用程序添加 "Sign Up with Facebook" 功能

I want to have a "Sign Up with Facebook" feature for my php application

我们正在创建一个 PHP MySQL 应用程序,我们在其中为用户提供注册表单。

我们还需要 "Sign Up with Facebook" 注册功能。

我用谷歌搜索了它,但我只能找到 Facebook 登录功能的代码。如果有人能帮助我找到确切的资源以了解通过 Facebook 注册功能,那就太好了。

提前致谢。

借用 CBroe 的回答,Facebook 只有登录功能,但是您可以使用继续按钮作为伪 "registration" 按钮。这是 find/configure 继续按钮的位置:https://developers.facebook.com/docs/facebook-login/web/login-button/ https://developers.facebook.com/docs/facebook-login/web

使用基于 Facebook 文档的结果,获取在系统中注册用户所需的变量。这是我为解决同一问题所做的工作。我在下面有一个名为 getUserInfo() 的函数:

function getUserInfo() {

    // Get what you need from FB's graphQL API
    FB.api('/me?fields=id,email,first_name,last_name', function (response, global) {

        // Set variables based on results of '/me' Graphql call
        let fbuserid = response.id;
        let fbuserfname = response.first_name;
        let fbuserlname = response.last_name;
        let fbuseremail = response.email;

        // I am defining variables for my site's registration form fields
        let fname = document.getElementById('fname');
        let lname = document.getElementById('lname');
        let email = document.getElementById('email');

        // Set input values in your form from the facebook results
        fname.value = fbuserfname;
        lname.value = fbuserlname;
        email.value = fbuseremail;

        // I make up a password but you don't have to
        var md = forge.md.sha256.create();
        md.update(fbuserid + fbuseremail + randomString());
        document.getElementById('pwrd').value = md.digest().toHex();

        // My form has steps so I auto-progress users to the next step since the Javascript filled in the form already. Completely optional
        document.getElementById("nextbutton").click();

    });
}

我在登录事件后调用 FB 按钮中的 getUserInfo() 函数,如下所示:

<div id="fbregister" data-size="medium" data-button-type="continue_with" data-layout="default" data-auto-logout-link="false" data-use-continue-as="false" data-scope="email" data-onlogin="getUserInfo()"></div>

总体情况是,用户单击,继续使用 facebook,他们登录,调用该函数,通过 JS 设置字段,然后用户进入下一步。一旦他们完成接下来的步骤,他们就会被注册。我希望这可以帮助您顺利开始。