I am trying to register a new user using the USER SERVICE API on my .NET Xamarin application. The process does not go through and I get the error code 3040 with the message " Message: Provided email has wrong format.". Please is roxxy.bill@gmail.com a wrong email format? Please what is the right format? How do I fix this?
Hello,
The email has the correct format. Have you added any validators in the Users schema for the email
column?
Regards,
Mark
Thank you very much for the quick reply. No, I did not set a validator. Would I need to add a validator?
Generally you do not need a validator. What is your application ID?
I just tried applying the “Email” validator and rerun the process but I still get the same error message. My app ID is “442BE07B-8C47-13D8-FF01-77F4F4AF5900”.
Could you please also check what version of the Backendless SDK from nuget you’re using?
Also, please show the code you use to register the user (do not include the entire code listing, just the snippet where you register a user)
The one version I have installed is 6.2.0.
This the code:
BackendlessUser newUser = new BackendlessUser();
newUser.SetProperty(“login”, “fName”);
newUser.SetProperty(“email”, “Email”);
newUser.Password = “pwrd”;
Backendless.UserService.Register(newUser, callback);
Console.WriteLine(newUser);
I am trying to collect user input so when they click a button it saves registers them as a User to the Backendless Console. I set the “login”, “email” and “Password” to the names of the variables holding the user input. Does it work that way?
There are several problems with that code:
- You do not have the “login” column/property in your Users table
- There is a required column called
firstName
. As you can see in the screenshot below, there is theNN
constraint, which means “Not Null (Required)”. There must be a value in the registration code for that (see the screenshot below). - You are hard-coding the password to the value of
pwrd
, it is technically correct, but all the created users will have that password.
- Please how do I add the “login” column?
- Yes, I do have a column in my registration for “firstName”. I assumed it setting “firstName” as the Identity field will automatically make it the “Login” field.
- Oh wow, I did not know that. Please how do I set that property to whatever password the user inputs?
You will find the answer when you watch this video:
Yes, the column is marked as identity and the value for that column will have to be used in the Login API. But your registration code that you shared does not set a value for that column,
newUser.Password = HERE YOU WILL GET THE VALUE FROM THE UI;
Thank you very much, I have applied your suggestions. It works now.