Update User Profile for Corona SDK

0 votes
Hi, I would like to save my player's gender and date of birth in their user profile using the user service. I am using Corona SDK and the App42 documentation is saying "coming soon" for "Create Or Update User Profile" for Corona. Do you support this function for Corona yet? Thanks, Scott
asked Oct 1, 2016 in Corona by gsglawson (10 points)

1 Answer

0 votes

Hi Scott,




Yes, we support this function in Corona SDK. Please find the below code for the same and let me know if you need any other help from our side: 

local userName  = "Nick"
local pwd = "********"
local emailId = "nick@shephertz.co.in"
local callBack = {}
local userService  = App42API:buildUserService()
local Profile = require("App42-Lua-API.Profile")
local profileObj = Profile:new()       
userService:createUserWithProfile(userName,password,emailId, profileObj,callBack) 
function callBack:onSuccess(object)
 print("User Profile : "..JSON:encode(object:getProfile()))
 print("User Profile First Name : "..object:getProfile():getFirstName())
 print("User Profile Sex is : "..object:getProfile():getSex())
function callBack:onException(object)
 print("Message is "..object:getDetails()); 



Himanshu Sharma

answered Oct 3, 2016 by hs00105 (2,005 points)
Thanks Himanshu. When I implement your code example I am getting an "Internal Server Error". The app error code is 1500. It could be "date of birth" since I need to use that field but I do not know what format your server is expecting. I have tried several variants of numbers and strings in the MMDDYYYY format but none of them seem to work.

local profileObj = Profile:new()

UPDATE: I do not think it is date related. I removed everything from profileObj and just sent an empty profileObj with valid username, password and email address to userservice:createUserWithProfile and it also returns internal server error (1500).
UPDATE2: I take that back. I do believe it is the "date of birth" field. I can update any field within the user's profile with no issue except for the "date of birth" field. If I put anything into that field (even one blank space) then I get the 1500 internal server error. Any help is greatly appreciated!
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com