You are not logged in.
procedure TSQLRestServerAuthentication.SessionCreate(Ctxt: TSQLRestServerURIContext;
var User: TSQLAuthUser);
var Session: TAuthSession;
begin
if User<>nil then
try
// now client is authenticated -> create a session
fServer.SessionCreate(User,Ctxt,Session);
if Session<>nil then
Ctxt.Returns(['result',Session.fPrivateSalt,'logonname',Session.User.LogonName]);
finally
User.Free;
end;
end;
a little request, after success login, can also return user's DisplayName in return JSON object, thanks!
Offline
After authentication, you need to get session ID and use SessionGetUser function to get logonName.
Ctxt.Returns(['SessionID',Ctxt.Session,'UserID',Ctxt.SessionUser,'GroupRightsID',Ctxt.SessionGroup,'UserName',SessionGetUser(Ctxt.Session).LogonName]);
{"SessionID":5385784,"UserID":3,"GroupRightsID":3,"UserName":"User"}
Offline
I use a web front, when client call '/auth?UserName=XXX&Password=XX&ClientNonce=XXX' to login, server will return a json object with "logonname" and private key, since logonname is just equal UserName, I have already know it, i need the user's DisplayName, then I need make a service interface to get this info, if when call /auth?, have return the DisplayName, then will don't need make this interface, hope it clear, thanks!
Offline