Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
17060 Discussions

Facebook Connect

Alexander_F_
Novice
14,651 Views

Something is happened now with my app, because when I try to login with fecebook I get the message that that the given url is  not allowed by the application and this works before, think that I have to add a web platform to my facebook app but what is the site url that I have to enter here or if is another solution let me know, I am getting this issue in Android and in IOS do not show the message but doesn't work too.

http://prntscr.com/8317ee

function facebook_login(){
    var fbLoginSuccess = function (userData) {
        //alert("UserInfo: " + JSON.stringify(userData));
        //get info
        facebookConnectPlugin.api("me/?fields=id,email,first_name,last_name,name,link,website,address", ["public_profile"],
            function (result) {
                fb_alias = result.name.toString().toLowerCase().replace(' ', '');
                //get user by alias
                $.ajax({
                    type: 'POST',
                    url: rest_url + 'mobile/get_user/' + '?callback=?',
                    data: {id:null, alias:fb_alias},
                    success: function(data){
                        data = $.parseJSON(data);
                        if(data.status == 'success'){ //exists
                            is_login = 'yes';
                            window.localStorage.setItem('biipit_is_login', is_login);
                            user = data.message[0];
                            window.localStorage.setItem('biipit_user', JSON.stringify(user));
                            window.localStorage.setItem('biipit_user_id', user.id);
                            if(user.account_type == 'B'){
                                $.mobile.changePage('#business_profile', {transition:'flip'});
                            }else{
                                $.mobile.changePage('#personal_profile', {transition:'flip'});
                            }
                        }else{ //new register
                            fb_email = result.email;
                            window.localStorage.setItem("biipit_reg_email", fb_email);
                            //create password
                            fb_password = 'biipit';
                            window.localStorage.setItem("biipit_reg_pass", fb_password);
                            //submit data
                            $.mobile.loading('show');
                            $.ajax({
                                type: 'POST',
                                url: rest_url + 'mobile/profile/' + '?callback=?',
                                data: {
                                    mode:'facebook',
                                    account_type:'P',
                                    alias:fb_alias, 
                                    alias:fb_alias, 
                                    email:fb_email, 
                                    password:fb_password,
                                    first_name:result.first_name,
                                    last_name:result.last_name,
                                    facebook_profile:result.link,
                                    personal_profile:result.id
                                },
                                success: success_profile,
                                error: error
                            });
                        }
                    },
                    error: error
                });
            },
            function (error) {
                //alert("Failed: " + error);
            }
        );
    };
    //check login status
    facebookConnectPlugin.getLoginStatus(
        function(result){
            if(result.status == 'connected'){
                fbLoginSuccess(result);
            }else{
                //login
                facebookConnectPlugin.login(["public_profile"],
                    fbLoginSuccess,
                    function (error) { 
                        alert("" + JSON.stringify(error)); 
                    }
                );
            }
        }, function(error){
                alert('Failed: ' + JSON.stringify(error));
        }
    );
}

 

1 Solution
John_H_Intel2
Employee
14,640 Views

I have attached screenshots of my XDK facebook settings, my developer.facebook.com settings, and my project itself. Hopefully you can see what you are doing incorrectly from them :)

Once built, it allows you to login with fb and post to your wall.

View solution in original post

0 Kudos
28 Replies
Alexander_F_
Novice
2,391 Views

Nope is the same issue by the way now I tested in both devices Android and IOS in Android get the same error and in IOS don't show nothing but doesn't work too.

0 Kudos
John_H_Intel2
Employee
2,390 Views

Can we stick to one platform at a time please? Focusing on one issue at a time makes it clearer to debunk what you are doing wrong. Try getting iOS working first based on the screenshots I posted earlier. That is all you should need. Make sure the values on your facebook developer account match what you are giving to the XDK.

0 Kudos
Joshua_S_1
Beginner
2,390 Views
@John using your screen shot above we added a platform with our bundle of. It now works. Thank you. This is wierd because this has worked for about a year with out that but with a web platform. They should update the guide. Nowhere on the guide does it say to add a platform. Thank you guys for putting out today's developement fire :)
0 Kudos
John_H_Intel2
Employee
2,390 Views

Glad you got it working :)

0 Kudos
Alexander_F_
Novice
2,390 Views

Hi if you want to made this works on Android devices what is the steps then?

Thank You.

0 Kudos
Alexander_F_
Novice
2,390 Views

Hey somebody have an idea what is Android KeyHash because to made this works on Android I need that

Thank You.

0 Kudos
Alexander_F_
Novice
2,390 Views

Thank you now works in both IOS and Android.

Thank You.

0 Kudos
Reply