Start a new topic

User registration not working

Hello,

I'm currently trying to make a login screen for an app and I have a problem because I can only create the first user with my app and everytime I try to add another one, the request fails.

I'm kinda new this all of this and I really don't know why I can't create more users, I've checked that the username isn't the same as the one I create first but It still doesn't work.

Here's the code of the registration:

  

public void submit() {
        getClient().user().create(mUsernameView.getText().toString(), mPasswordView.getText().toString(), new KinveyUserCallback() {
            @Override
            public void onFailure(Throwable t) {
                if (getActivity() == null){
                    return;
                }
                CharSequence text = "Couldn't register user";
                Toast.makeText(getActivity(), text, Toast.LENGTH_LONG).show();;
            }

            @Override
            public void onSuccess(User u) {
                if (getActivity() == null){
                    return;
                }
                CharSequence text = "Registration og  " + u.get("username")+ " successful.";
                Toast.makeText(getActivity(), text, Toast.LENGTH_LONG).show();

            }

Thanks in advance



Schwdim,


When you have a logged in user, you should be able to call create again without much issue.    Do you have the error that is being returned to your client?  If not can you please turn on library-based troubleshooting -- See the guide for that over here:  http://devcenter.kinvey.com/android/guides/troubleshooting


Thanks,

Well it does show my toast message but it has no reasons to show it, I'm going to turn on library-based troubleshooting and I'll tell you if I see something strange.

Thanks for the help !

I haven't figured out the cause yet, but I've discovered that it's not the first user created that works, but the first created on a device.

I've tried using an emulator and could create a user and then on my real phone I've created a second one..

I don't know if this helps but I've thought it maybe would.


Okay, I've found the error but I'm not too familiar with it and I don't really know why it occurs and how to fix it.

Anyways here the error that I've found while debugging :

 

java.lang.IllegalArgumentException: expected final value <UserNameInField> but was <FirstUsernameRegisteredOnThisDevice> on username field in com.kinvey.java.auth.KinveyAuthRequest$AuthRequestPayload

 

Login or Signup to post a comment