开发者

How do I get a Facebook App on my fan page to see the user details that are visiting my app?

I am creating an app in Facebook that will work with my fan page.

When fans click on the tab, they will see a page where they can enter in some information. I want to personalize that page by 开发者_StackOverflowdisplaying their name and facebook user id?

Is this even possible without going through the whole permissions page?

Also, while on the app for my fan page, is it possible to display a dropdown list of all fans of the page?


You cannot get the user's name or ID without asking for their permission.

I use the PHP SDK to access the signed request. This will give you access to the user's locale, country, whether or not they like your brand page, and a few other unspecific things. Once a user authenticates your app the signed request can give you more of the user's information. If all you need is the user's name and ID, the signed request is a more efficient way to get it than making a Graph API request.

Read more - https://developers.facebook.com/docs/authentication/signed_request/


Is this even possible without going through the whole permissions page?

As far as I know, nope. I have basic user integration on a Joomla site I run and it requires you to grant permission before your application can pull user data via the API.

It would also be a gross violation of security to allow you to just willy-nilly request users information without them explicitly granting you permission.


You can show the username with link to their profile, without having to ask for any kind of permission. You can see the demo right here - http://www.facebook.com/digimantra?sk=app_256564141033045 . The following snippet displays the username within the facebook page -

<html xmlns:fb="http://www.facebook.com/2008/fbml">
 
    <div id="fb-root"></div>
    <script>
        window.fbAsyncInit = function() {
            FB.init({
                appId: 'APP_ID',
                cookie: true,
                xfbml: true,
                oauth: true
            });
 
 
        };
        (function() {
            var e = document.createElement('script'); e.async = true;
            e.src = document.location.protocol +
                '//connect.facebook.net/en_US/all.js';
            document.getElementById('fb-root').appendChild(e);
        }());
    </script>
    <fb:serverFbml>
        <script type="text/fbml">
            <div style="font-size:2em;" >
                Hello, <fb:userlink uid="loggedinuser"/>
            </div>
        </script>
 
    </fb:serverFbml>
 
</html>


It used to be available using fb:name FBML tag but this is no longer supported now that pages are creating using iframes instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜