Get link to Facebook profile with passport.js - javascript

I am using passport.js to let users log in.
I am wondering if it's possible to create a link to their profile on their social media account?
For instance, when logging in using Facebook, I can get an ID, but the link https://www.facebook.com/profile.php?id=__ID__ doesn't work.
Maybe it's not possible at all since some Facebook users might have their Facebook profile hidden even though they use their account as login for other websites.

From what i know, this is not possible using passport at least.
The reason why the link doesn't work is that the ID returned by Facebook is always app specific so different apps would get different IDs for the same user. So you don't get the "official" ID of a user which you could use for building the URL.
However, the Facebook API returns a link to a users timeline which should be the one you are looking for (https://developers.facebook.com/docs/graph-api/reference/user/). But from what i see in the documentation of passport, this information is not returned. So if you want to get the link you need to work with the Facebook API directly.

Related

LinkedIn API Login With Specific Account

I would like to login using my own account in conjunction with the LinkedInApi. The problem I have is that most examples I can see either use a cookie or login interface for local users login credentials. However my aim is to login with my own specific account by providing my username and password.
I can then extract the testimonials from my profile and display them on my website.
Is this possible? And if so do you have any examples of how this can be achieved?
After thinking about this for a considerable amount of time I realised that the answer is quite simple.
If you make the API call on the server side you can specify the credentials. For example in an MVC application you might make the call on the controller action method.
If you want to allow users to login using LinkedIn you should first create an app in LinkedIn from the below link
https://www.linkedin.com/developer/apps.
Then Add LinkedIn login button from this Url
https://developer.linkedin.com/docs/signin-with-linkedin
Below is the link you will find the complete solution.
http://www.c-sharpcorner.com/UploadFile/145c93/sign-up-users-using-linkedin-and-save-users-detail/
I am not promoting the article, just providing the link where you will get the complete solution.

Display profile data LinkedIn Api without authentication

Quick questions, but can I display profile data from my own LinkedIn page on a website through the JavaScript SDK, without having the user login through the authentication layer ?
I don't want to display any other information other than from my profile, I was under the impression this is possible without a user logging in.
https://developer.linkedin.com/docs/js-sdk
I have connected correctly:
<script type="text/javascript" src="//platform.linkedin.com/in.js">
api_key: xxxXXXxxxXXXxxx
onLoad: linkedInLoaded
</script>
but then using the follow:
IN.API.Profile("me").fields([]);
Tells me I require authentication.
Hi #CHEWX I misunderstood your original question. Yes, you are correct, what you are trying to do is not possible. What are you looking for is the ability to make an unauthenticated call to pull any random profile (and for your use-case, you would always be pulling your own profile). However, LinkedIn does not have any unauthenticated APIs available.
The only thing that comes close to what you are looking for is a drop-in plugin which you can find here: https://developer.linkedin.com/plugins/member-profile
You could build some service that makes an authenticated REST call to pull your profile every so often, and then push the updated profile info to wherever you are saving it to display it on your website.

How to get facebook user ID or name without Facebook Application

I'm working on web app which is NOT a Facebook Application.
I want to get current logged user's ID (I'm not sure if this is the right expression, I mean facebook.com/userid ) or user's name using Javascript.
Please if you don't know how to do it or if you don't have any suggestion what should help me, don't comment , thanks.How can I do this?
You cannot get the details (facebook id etc.) of the currently logged-in facebook user without using an app.
To query for the current user, you'll have to query for the /me and that requires an active access token which you can only get when the user authorizes an app!

Facebook Graph API - Get profile picture prior to authenticating

Ok so i've tried the following:
FB.api("/me", {fields: "picture"}, function(response){
console.log(response);
});
And i'm trying to work around http://graph.facebook.com/USERNAME_OR_USERID/picture since obviously i don't know the users ID prior to authenticating.
All i want is a "modern" feel within the website, so i'd like to present the user with his or her's profile picture on the "login" div presenting the facebook login button. Is this possible? I know that Facebook and their graph api prohibits most such features but i would hope that a public profile picture would be accessible through the graph API..
I've Googled around and all the solutions say "use the USERNAME in the URL and you're fine" but i'm not, so to clear out any doubts, is this possible?
Error message: An active access token must be used to query information about the current user.
You can get everyone's Facebook profile picture without authentication.
You just call http://graph.facebook.com/USERNAME_OR_USERID/picture?type=large. This URL redirects you to image URL.
Type may be normal,small or large.
I also have questions for you:
How do you want to display the picture of someone without knowing who he/she is?
How can you guess which account the visitor will use to connect?
It looks like you want to know whose Facebook account was lastly connected on the browser of your visitor. Technically, you would want to read another site's cookies, which is 1) not allowed 2) impossible.
Several additional things you need to know:
http://graph.facebook.com/USERNAME_OR_USERID/picture is a public way to retrieve someone's photo. You don't need a token for that. What else do you need?
Using FB.API("/me", ...) from the JS SDK implies that "me" represents the connected user. It cannot just be used alone.
By the way, identical questions have already been answered and accepted:
Facebook app without prompted authentication
Get Facebook user's profile picture prior to authenticating app
Why would you hope the impossible?

Displaying friends' user who authenticated the app

I'm going more in depth in the Facebook javascript sdk but I am still new to it. I would like to display for every user on my website who logged with Facebook, their friends' pictures who also authorized the app. It is clearly and simply possible by using PHP SDK, but I only want to make use of javascript SDK to improve the speed of my site. Does anyone have an idea ?
Best,
Newben
You can use FQL to query the current user's friends SELECT id, name FROM user where uid IN (SELECT uid1 FROM friends WHERE uid2=me()) AND is_app_user=1. This query does two things. Finds all the friends and find only the friends who have your app installed.
For additional information see:
http://developers.facebook.com/docs/reference/fql/user/
and
http://developers.facebook.com/docs/reference/fql/friend/

Categories