Ben Jackson
Ben Jackson

Reputation: 1138

How to get my FaceBook Public Profile URL via the Javascript API

I'm using the JavaScript API to log on to FaceBook, and I can call

FB.api('/me?fields=id,name,email,picture,website', function(data) {...});

to get basic details from my profile. What I really want is a URL for my FaceBook profile that I can share with others - they would only be able to see public information from my profile - e.g. the sort of public profile page you get when searching for new friends, https://www.facebook.com/profile.php?id=100002010472154&hc_location=friend_browser&fref=pymk for example. I was hoping the website property would do this but no data is returned in relation to this and it's unclear whether this has been deprecated.

Is this possible?

So to clarify I just want my public profile page URL, I don't need access to feeds etc. I'm aware there are some other questions and answers in this space and that Graph API security has been tightened recently, but I don't think any other questions deal with access just to a user's public profile page URL.

Upvotes: 0

Views: 1700

Answers (2)

C3roe
C3roe

Reputation: 96407

The link field will give you a URL that automatically redirects to the user’s profile.

Upvotes: 1

andyrandy
andyrandy

Reputation: 74004

The "link" field would be what you need, i guess:

FB.api('/me', {fields: 'id,name,email,picture,link'}, function(data) {...});

Upvotes: 3

Related Questions