Hey guys,
I'm sure I'm missing (again!) some doc page... I see that LOGIN_OUT_DATA is available only when the login is successful: is there any equivalent way to send data to the client upon unsuccessful login?
Thanks,
Pino
LOGIN_OUT_DATA equivalent for unsuccessful login?
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
No, you can send a custom error if you want, but no objects.
Of course your error string can be formatted as you please so you can later extract parameters from it, if necessary.
For the details on custom errors, check this post:
viewtopic.php?f=18&t=14390
Of course your error string can be formatted as you please so you can later extract parameters from it, if necessary.
For the details on custom errors, check this post:
viewtopic.php?f=18&t=14390
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
Hi,
I did try that but it generates an "index out of bound" error on the client (Unity, so it's C#) and the method stops processing because of that :/
I did try that but it generates an "index out of bound" error on the client (Unity, so it's C#) and the method stops processing because of that :/
Cheers!
Pino
Pino
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
I think you're using a pretty old API, please get the latest update.
http://www.smartfoxserver.com/download/sfs2x#p=updates
http://www.smartfoxserver.com/download/sfs2x#p=updates
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
Lapo wrote:I think you're using a pretty old API, please get the latest update.
http://www.smartfoxserver.com/download/sfs2x#p=updates
Hi Lapo,
downloaded the current DLL you pointed me to, but the result is unchanged, running on iOS6 (iPad2) this is what I get in the XCode tracing panel:
[SFS DEBUG] Formatting error string failed with exception: Array index is out of range
Am I missing something?
Cheers!
Pino
Pino
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
Wait... maybe I did miss something else ... I'll double check.
Cheers!
Pino
Pino
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
Ok, no, checked everything and I still have:
[SFS - DEBUG] <<< Packet Complete >>>
[SFS - INFO] Message: Login { Message id: 1 }
{ Dump: }
(short) ec: 200
(utf_string_array) ep: [System.String[]]
[SFS - ERROR] Formatting error string failed with exception: Array index is out of range.
[SFS - DEBUG] <<< Packet Complete >>>
[SFS - INFO] Message: Login { Message id: 1 }
{ Dump: }
(short) ec: 200
(utf_string_array) ep: [System.String[]]
[SFS - ERROR] Formatting error string failed with exception: Array index is out of range.
Cheers!
Pino
Pino
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
It looks like there's a mismatch with the parameters in the String.
Can you please show me what's being sent from the server side?
Can you please show me what's being sent from the server side?
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
Sure,
On te server side:
Declaration:
Code usage in the login handler (the initial test):
On the client, after the SFS initialization I have:
On te server side:
Declaration:
Code: Select all
public enum BionautsErrors implements IErrorCode {
WE_NEED_LINKING_PROFILE(200),
BAD_LINKING_USERNAME(201),
BAD_LINKING_PASSWORD(202),
USERNAME_IN_USE(203);
private short id;
private BionautsErrors(int id)
{
this.id = (short) id;
}
@Override
public short getId() {
// TODO Auto-generated method stub
return id;
}
}
Code usage in the login handler (the initial test):
Code: Select all
if (!linkNow && !createNow)
{
// Build a prepared statement
stmt = connection.prepareStatement(FBDB_SELECT);
stmt.setString(1, FBemail);
// Execute query
res = stmt.executeQuery();
if (!res.first()) // User has no account with Facebook email
{
// This is the part that goes to the client
SFSErrorData errData = new SFSErrorData(BionautsErrors.WE_NEED_LINKING_PROFILE);
connection.close();
trace("FB Login Error: no user");
throw new SFSLoginException("FB Login Error: no user", errData);
}
// Successful FB SSO login
outData.putUtfString(SFSConstants.NEW_LOGIN_NAME, res.getString("usernameusers"));
}
On the client, after the SFS initialization I have:
Code: Select all
SFSErrorCodes.SetErrorMessage (200, "User not found, Link or Create?");
SFSErrorCodes.SetErrorMessage (201, "User {0} not found!");
SFSErrorCodes.SetErrorMessage (202, "Wrong Pass for {0}!");
SFSErrorCodes.SetErrorMessage (203, "{0} is taken!");
Cheers!
Pino
Pino
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
I just tried adding a fake paramenter to that error code 200... just in case the paramenter was mandatory, but nothing changes :/ In the meanwhile (while you study the issue) I'm going back adding the code as a paramenter to one of the standard error messages and checking the received message to see if it contains that code... not efficient but it works
Cheers!
Pino
Pino
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
Ok, I have asked ThomasLund to take a look, he knows the C# API much better than me
-
- Posts: 1297
- Joined: 14 Mar 2008, 07:52
- Location: Sweden
Re: LOGIN_OUT_DATA equivalent for unsuccessful login?
The C# API is using a string[] to store error messages in. I changed that to now use a List<string> instead.
If you hit me up with a PM with your email, I can send you a SVN build so we can test this and make certain it works as you expect it.
/T
If you hit me up with a PM with your email, I can send you a SVN build so we can test this and make certain it works as you expect it.
/T
Full Control - maker of Unity/C# and Java SFS API and indie games
Follow on twitter: http://twitter.com/thomas_h_lund
Follow on twitter: http://twitter.com/thomas_h_lund
Who is online
Users browsing this forum: No registered users and 107 guests