Get email user facebook

Hello everyone, I use sdkbox facebook, to log in to the app, the process seems to be successful, but I need to know how I can capture the user’s email once the loguin is complete?

When you ask for permission it indicates that my app can access the email, name and photo

1 Like

i never try to get the email, you can try:

0x01 fetch friends info

        FBAPIParam params;
        params["fields"] = "id,email,name,installed,first_name,last_name,picture.type(small)";
        api("me/friends", "GET", params,"__me_friends__");

0x02 deal with data

void HelloWorld::onAPI(const std::string& tag, const std::string& jsonData)
{
    CCLOG("##FB onAPI: tag -> %s, json -> %s", tag.c_str(), jsonData.c_str());
    if (tag == "__fetch_picture_tag__") {
        picojson::value v;
        picojson::parse(v, jsonData);
        std::string url = v.get("data").get("url").to_str();
        CCLOG("picture's url = %s", url.data());

        _iconSprite->updateWithUrl(url);
    }
    else if (tag == "__me_friends__") {
        // code here;
    }
}

Thanks,

Good morning, thanks for the information, sorry for the ignorance, but how can I apply that code to cocos creator and javascript?

did you try to find the javascript example ?

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Good afternoon,

With the example of the shared link, it worked correctly.

Thank you very much