getting facebook user ID - javascript

is there ant way to get Facebook user Id by passing the email and password of the user through a graph API....what i want to do is,i want to get the profile details of a particular user..if we know the user id then the details of the particular user can be obtained by the GRAPH API..
https://graph.facebook.com/ID
but i don't know how to get the Facebook user id.....please help me out....
I'm using JavaScript and html5 for mobile applications..both android and ios..and the IDE's are APPMOBI and PHONEGAP

You can try getting an access token by logging in using the username and password, then calling https://graph.facebook.com/me and getting the id field. I don't think there's a direct way of getting an id through the API just using the username and password without getting an access token for that user, which would require that the user accept your appId.

Related

unable to login with updated user after changing user info via PUT request

Newbie so apologies if I am not concise enough on this. Creating a simple application in react that displays movies and allows users to have profiles. I am running into an issue with retrieving information from my database. When I sign up and register as a user for the first time, my data is stored in my db and I am able to login via username and password.
Once logged in, I can then navigate to my profile and update my information (username, password, email, birthdate) and using a "handleUPdate" function I am successfully able to update the user info and this new information shows in my database. The issue is when I am redirected back to login after updating my information, the system does not recognize my credentials (despite the updated user info showing in my mongo db). I think the issue is occurring either in my mainView, profileView, or loginView. For reference, i've attached my repo link: https://github.com/jchasehuskey/myFlixx-client-final.git.
I can include more information if needed. The error I am getting when trying to login via the new username and password is: " POST https://myfavflixdb.herokuapp.com/login 400 (Bad Request). "
Again, it's unable to retrieve the updated user info from the DB. I have been dragging on this for days and am not sure where I am going wrong. I could be asking the wrong questions or giving the wrong information. Any help would be much appreciated.

Shopify - get customer email from customer object? (js - scripttag)

I need to create a cookie with clientID(need email to create it), when customer register/login on shopify shop.
How can I get email during register/login? Is it possible to get it from Customer object(js injected via script-tag) and how? The only possible way I see at the moment is to create onclick event on register/login and catch customer e-mail from post?
CustomerId (__st.cid) won't work for me.
You have access to the {{customer.email}} attribute.
Once the user register he is redirected to the account page and he is logged in already.
So on the account page you just create the cookie by passing the customer.email to a script and set it there.

Facebook Login For Rest Api

I am trying to implement Facebook login SPA. I am using the JavaScript SDK for the login. Fb authorized the user and token is received. Token is send to the web API. When API try to fetch the data from the token only Facebook id and name return from the Facebook graph api. Even though I have set the scope for the different data in java script sdk. If i fetch the data using javascript sdk. In that case i am getting the complete data whatever in the scope.
I think your asking "why am I not getting all the data I requested?". If so the most common reason is because permissions aren't set. For instance if the user grants permission to "public_profile" then Facebook will authorize your app to obtain every field that that the "public_profile" permission permits, in this case the following:
id, name, first_name, last_name, age_range, link, gender, locale, picture, timezone, updated_time, verified
obtained via
FB.api('/me',
'GET',
{"fields":"id,name"}, //any of the other fields here
function(response) {
// Insert your code here
} );
however if added 'email' in as a field then the Facebook would return everything except the 'email' because there a permission specifically for granting access to the users email called email. You can see what permissions enable what data returns at https://developers.facebook.com/docs/facebook-login/permissions
and you can test it at https://developers.facebook.com/tools/explorer. I hope that's what you where trying to say in your question. Cheers!

Facebook api call

I am creating a website in PHP and i want to use login with Facebook in my website. I have created an app ID in Facebook developer. Facebook login is working but i want to retrieve email id which is used on Facebook login.
here is my JavaScript code :
$facebook.api("/me").then(
function(response) {
console.log(response);
alert("Welcome " + response.email);
},
function(err) {
alert("Please log in");
});
Output:
response.email is undefined.
On console log i am getting an object like object {name:"xxx",id:"111"}
How to retrieve Facebook login email id?
Facebook provides all the details which are public or approved by facebook. So in that case you cannot get email-id everytime.
Suppose one user is not using email in his account or email is private, than you cannot get his email-id.
Regards.
In order to get the user email, you will need to follow these steps:
Set the email permission for your app.
When you call $facebook.api("/me") try calling like this $facebook.api("/me?fields=id,name,email") by doing this you should get the email of the logged in person.
Note:
Even if you have set the email permission some user sign up for facebook using their mobile no. as username or some user want their email to be private by setting privacy, so, in that case you won't get the get the user email.
So in case you want to save user in database for future reference work on id as this is the unique identifier for that user.
In case you want user email and if fb doesn't provide it you can ask explicitly.
Hope this will help you.

Getting taggable id of a logged user by facebook id

In facebook graph api 2.0+ I can retrieve logged user friends list by calling "me/taggable_friends" and I receive list of objects with profile picture, name, and id (lets call it "taggable_id") which can be used in mentioning performed by my app.
When user logs to my app have his real facebook id which is "worth" more then "taggable_id" so is it possible to retrieve taggable_id of a logged user with the use of facebook id? When I call "/me/" I don't receive on. Is there a work around?
No it is not possible. Not in any way.

Categories