I have been getting some very weird things happening with a token system i am using and i think i have worked out why but dont know how to fix it.
Basically I am using tokens to make sure someone is logged in to give them access to my app.
I log them in via a http request to a php file which then returns some xml with a token. I acess it as follows:
private function loginResult(event:ResultEvent):void
userToken = event.result.token;
where userToken is a String.
I get the token from the uniqid() php function
Sometimes the token becomes infinity or 0 in my application when i can clearly see in my network monitor that it is sending a normal token.
I have descovered one case when this always happens is when the token begins with '1e'.
This reads infinity and when i convert to a string returns null.
I think it is assuming it is a different type but i have no idea how to fix it.
I have tried using userToken = event.result.token as String;
but it just becomes null.
If anyone has any ideas how to solve this or a different method to use id really apreciate it!
Thank you in advance
I have fixed this problem by always adding a letter onto the end to force flex to see it as a string.
The format of the string (1e1242) 'looks' like scientific notation to flex. I think casting it to string, ie userToken = String(event.result.token);, or the other 'force type' method of userToken = event.result.token as String;
There are subtle differences between they way those two methods work that I don't fully understand, but one or the other usually works.
We use a similar token method, but our tokens are 32 characters Alphanumeric (upper/lowercase/numerals) randomly generated at login. We also force all requests out of flex to https so the token isn't easily captured.