Page 1 of 1

Using Facebook API to login

Posted: Fri Jun 05, 2015 7:59 pm
by Leonardo Valentin Zeferino

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


Using Facebook API to login

Posted: Mon Jun 08, 2015 7:22 am
by Serhii Kulibaba

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.


Using Facebook API to login

Posted: Mon Jun 08, 2015 1:16 pm
by Leonardo Valentin Zeferino

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!


Using Facebook API to login

Posted: Mon Jun 08, 2015 3:12 pm
by Alena Prykhodko

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.


Using Facebook API to login

Posted: Mon Jun 08, 2015 6:47 pm
by Leonardo Valentin Zeferino

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


Using Facebook API to login

Posted: Wed Jun 10, 2015 10:56 am
by Serhii Kulibaba

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