This is driving me cray. I am trying to retrieve the Facebook id after logging in. I am assuming I have to use the attribute mapping in order to achieve this? Any thoughts?
Facebook Attribute Mapping with StormPath to retrieve the Facebook ID
107 Views Asked by user992731 At
2
Heyo, Just thought I'd reply here too in case anyone else has questions about this.
I looked at the Facebook scopes reference page, and it says that
public_profile
is the scope that contains the user ID. So, I went to my Facebook Directory, and under 'Provider Configuration' on the 'Scopes' tab, I addedpublic_profile
. Under the 'Attribute Mappings' tab, I addedid
as the Attribute Name and setcustomData.id
as the 'Stormpath Field Name'.When users log in to my web app using their Facebook credentials, their ID is saved directly to their account's customData:
To grab this data from the Account's customData and display it on the profile page of the React-Express sample project, you need to do two things:
web.me.expand.customData
config is set to true in order to have the custom data fields populated,name="customData.id"
, like this:This is covered in the docs under the Access custom data fields by prefixing field names with customData section.