Search code examples
angularjssdkbackand

Backand.signup() - "Create My App User" failed to perform


I'm trying to register a new user using:

Backand.signup(firstName, lastName, username, password, password2);

but I end up getting:

POST https://api.backand.com/1/user/signup 504 (GATEWAY_TIMEOUT)

When I check the logs (Log > Server Side Exceptions), I notice this error:

An unexpected signup exception occured The following action: 
"Create My App User" failed to perform: The operation has timed out 
The operation has timed out Exception has been thrown by the target 
of an invocation. The operation has timed out

I haven't touched the "Create My App User" script.

Security & Auth > Configuration > Public App: Turned on and set to User. I've also toggled anonymous on and off and switched between ReadOnly and User in case of a permission issue.

It was working just fine a few weeks ago, and a few times I was able to get an entry into the Security & Auth > Registered User's table, but I can't get it to create any new entries in my app's user table or even work at all now.

Any help would be appreciated.


Solution

  • Based on the server side error that returned from the "Create My App User" action, this is a security issue.

    The Action leverage the front-end user permission and, in this case, it requires that Anonymus access will be able to update the users object.

    The error started after you turned off the anonymous switch or changed it to read-only.

    The solution is to use Admin's permission in the server side action. To add the Admin permission you can use the basic auth Authorization header.

    Change the headers code to be this line:

    headers:{'Authorization':'basic ' + btoa (username + ':'+ password) }

    So the new code in the "Create My App User" Action should look like this:

    var response = $http({ method: "POST", url:CONSTS.apiUrl + "/1/objects/users", params: {parameters: {"sync": true}}, data: parameters, headers:{'Authorization':'basic ' + btoa (username + ':'+ password) } });

    The username is the app master token (Securit & Auth /social &keys).

    The password is the Admin user key (Team / key Icon near the username)