8

I have an Android application that uses Facebook authentication, so I know users access token. In the Android application I have a screen with a WebView that loads a page from the server with Facebook Comment box.

The server page (loaded in webView):

<!DOCTYPE html>
<html>
    <head>
        <style type="text/css">
            .fb_ltr{height:100% !important; overflow-y: scroll;}
            #u_0_1{position:absolute !important;}
        </style>
    </head>
    <body>
        <div id="fb-root"></div>
        <script>
            (function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;

                js = d.createElement(s); js.id = id;
                js.src = "http://connect.facebook.net/he_IL/all.js#xfbml=1&appId=MY_APP_ID";
                fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk'));
        </script>

    <div class="fb-comments" data-href="MY_URL" data-width="470" data-num-posts="10"></div>

    </body>
</html>

When I open that screen with the WebView, I need to login again into FaceBook.
Is there any way to pass the access token (or other parameter) with the WebView?
Note: I can also change the HTML if it's imposible with WebView

Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
NickF
  • 5,637
  • 12
  • 44
  • 75

1 Answers1

0

No, it's not possible to take the access token in your native app and created a logged in session for that user in a webview -

If you need the user to use web-based services of Facebook such as social plugins, it's more likely they'll be logged into Facebook on the main device browser (e.g. Safari or Chrome) so maybe you can consider opening that instead of a webview?

Igy
  • 43,710
  • 8
  • 89
  • 115