So I am trying to just login a user with facebook, then all I want to do is use their username as the username for my online section of the game. I am however very unfamiliar with the facebook API, and I just can’t seem to get the info I want.
All I need is to get the facebook username. I am able to get the full name of the user by adding a section into the facebook listener.
if ( commandProcessedByFB == GET\_USER\_INFO ) then username = response.name end
but I don’t want the users full name I just want their username instead, so I tried
if ( commandProcessedByFB == GET\_USER\_INFO ) then username = response.username end
but this returns a nil. I have attached my whole module below, its just an adaptation from the given facebook example.
Because the ID is just a string of numbers, so I can’t use that as a displayname and I don’t want to display the users full name due to privacy issues.
local function processFBCommand() local response = {} if requestedFBCommand == GET\_USER\_INFO then response = facebook.request( "me" ) -- facebook.request( "me/friends" ) -- Alternate request end printTable( response ) end
Then taking response.username to use as the username but that returns a nil.
that there are values for, name, first name, last name, and ID, but nothing about a username. How do you typically handle a username when someone logs in using facebook?
In my game I’ll allow users to upload custom made levels, and each level was going to have the username of the user that created it. I noticed that 2 Dots shows the user’s email, but that doesn’t seem like a good idea. I know I have the user ID but that’s just a string of numbers and doesn’t make sense either. Then angry birds allows you to choose either your own name or a random name. I thought that facebook users already had a custom username that I could use?
Facebook does not have a “Username”. You use your email address to login. The ID is the unique user ID that you can use with your online service for its ID. Then you can display the first name for privacy reasons. You can also request the email permission and the email will be included in the /me package.
Because the ID is just a string of numbers, so I can’t use that as a displayname and I don’t want to display the users full name due to privacy issues.
local function processFBCommand() local response = {} if requestedFBCommand == GET\_USER\_INFO then response = facebook.request( "me" ) -- facebook.request( "me/friends" ) -- Alternate request end printTable( response ) end
Then taking response.username to use as the username but that returns a nil.
that there are values for, name, first name, last name, and ID, but nothing about a username. How do you typically handle a username when someone logs in using facebook?
In my game I’ll allow users to upload custom made levels, and each level was going to have the username of the user that created it. I noticed that 2 Dots shows the user’s email, but that doesn’t seem like a good idea. I know I have the user ID but that’s just a string of numbers and doesn’t make sense either. Then angry birds allows you to choose either your own name or a random name. I thought that facebook users already had a custom username that I could use?
Facebook does not have a “Username”. You use your email address to login. The ID is the unique user ID that you can use with your online service for its ID. Then you can display the first name for privacy reasons. You can also request the email permission and the email will be included in the /me package.