Sarina DuPont from Embarcadero has a new blog post up expanding on BaaS user management with Kinvey in Delphi XE6 Firemonkey. These components should work cross platform on Windows, Android, IOS, and OSX. They are also available in AppMethod. This new example is a pretty complete login system using the BaaS components. It provides sign up capability, login capability, logout capability, and change password capability. Once you understand how the data comes back from the BaaS calls into the TBackendEntityValue object it looks like BaaS is a breeze to use. In the example she has a TBackendEntityValue as a private variable on the form where the results of the Login and Signup process are stored. It’s where you can go to access the AuthToken once you have logged into the BaaS provider. In any event the new piece of code in this demo is for changing the user password. This is done by creating a JSON object pair and sending it to the server using the UpdateUser function. Here is the code snippet:
procedure TForm7.ButtonChangePasswordClick(Sender: TObject);
var
LPassword: TJSONObject;
LUpdatedAt: TBackendEntityValue;
begin
LPassword := TJSONObject.Create;
try
LPassword.AddPair('password', EditPassword.Text);
BackendUsers1.Users.UpdateUser(FLogin, LPassword, LUpdatedAt);
Login;
finally
LPassword.Free;
end;
end;
Head over and check out the full source code for building a login system using the BaaS components in Delphi XE6 Firemonkey.