My site (http://sukabumi-marketplace.com) using facebook graph for user login. I haven’t maintenance it for the last 2 months. when I try to login few days ago it return an error because the username from Facebook graph API was empty.
I googled why this is happened. and got that facebook has depecrated the /me/username API. alternatively we can use email as username. but I resist to use facebook username as my application users username. so I do some trick.. seems stupid but it works.
I scrapped the user facebook profile using nokogiri. and get the username value from the meta tag (until facebook remove the username from the html code.. but I think it won’t happen :P). here’s the code in ruby:
html = RestClient.get(link)
doc = Nokogiri::HTML(html)
username = doc.css('head meta').attributes["content"].value
Hope it helps, cheers ! 🙂