Leonardo Valentin Zeferino
Posts: 0
Joined: Fri May 29, 2015 2:07 pm

Using Facebook API to login

Hi!

Could you clarify me?

I deployed the facebook API in my app and it works. I used the facebook data to register the user in my User collection.

Now, I want to use Facebook API to user login in my app and I don't know what I need to do. I want that always when the user click to enter in my app, my app don't ask his/her login or he/she needs to click "connect with facebook" again. Everything needs to be automatic.

I read the facebook instruction (https://developers.facebook.com/docs/...). I think that Facebook API with Appery.io sends me the access token short-term. Now, what do I need to do?

Thanks for helping me!

inscrever

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Using Facebook API to login

Hello Leonardo,

You should get user name, email or id from facebook (it depends on what do you need) and save it to storage variable.

Every other application start send this variable to appery login service.

Leonardo Valentin Zeferino
Posts: 0
Joined: Fri May 29, 2015 2:07 pm

Using Facebook API to login

Thanks Sergiy!!

I was trying to develop the code. I got the data's user (user name, email, etc) but I need to change the short access token to long access token as described in the facebook tutorial bellow.

Image

How can I make a GET call from server-side? I created a service but I think 1) this service isn't from server-side and 2) this call doesn't accept JSON response as images bellow.

Image

Image

Image

Image

Could you help me?

Thanks a lot!

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Using Facebook API to login

Hello Leonardo,

We are very sorry, but this is something outside the scope (http://devcenter.appery.io/support-po...) of our support.
You may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).
Probably someone from community will help you as well.

Leonardo Valentin Zeferino
Posts: 0
Joined: Fri May 29, 2015 2:07 pm

Using Facebook API to login

OK Alena.

Let me try modify the question to our scenario.

How can I make a GET call with javascript in server code and get the response of the call?

I tryed using the code bellow but without success.

code
var url = "https://graph.facebook.com/oauth/access_token&quot
var params = "somevariable=somevalue&anothervariable=anothervalue&quot
var http = new XMLHttpRequest();

http.open("GET", url+"?"+params, true);
http.onreadystatechange = function()
{
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(null);
/code

Error:
code
Script facebook_long_term: ReferenceError: XMLHttpRequest is not defined ( @ 13 : 15 ) -> var http = new XMLHttpRequest();
/code

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Using Facebook API to login

Leonardo, please follow this documentation: https://devcenter.appery.io/documenta...

Return to “Issues”