Regarding user logout via REST API

I am using REST API in AS3 programming.
When I logout user, logout is successful.
On successfull logout, I am clearing any local shared objects that store user token and other user data locally.
But when I login again I get this error {“code”:3064,“message”:“Not existing user token. Relogin user to update your user token”}.
If I quit the app and login again then login is successful.
I am wondering why I am getting following error?
Will be thankful of any guidance.
Below given is code I am using.

public static var headers:Array = [
new URLRequestHeader('application-id', '2C268F11-55C9-113B-FF15-F291A39B4400'),
new URLRequestHeader('secret-key', <app secret key>),
//new URLRequestHeader('application-type', 'REST'),
new URLRequestHeader(Backendless.HDR_APP_TYPE, Backendless.APP_TYPE)

public function Backendless() { }

public static function Call(url: String, method: String, params: Object = null, success: Function = null, error: Function = null, token: String = null): void {
var ldr: URLLoader = new URLLoader();
var req: URLRequest = new URLRequest(url)

if (params != null) {
if (method == URLRequestMethod.GET) {
var vars: URLVariables = new URLVariables()
for (var p: String in params) {
vars[p] = params[p];
} = vars;
} else {
trace("request data:", JSON.stringify(params)) = JSON.stringify(params)
//trace("method :: " + method);
req.method = method;
if(method != URLRequestMethod.DELETE){
req.contentType = Backendless.CONT_TYPE;
req.cacheResponse = true;
req.useCache = true;
req.requestHeaders = headers

if (token != null) {
req.requestHeaders.push(new URLRequestHeader('user-token', token))

var parseData:Function = function(e:Event):void{
var data:Object
trace('loader data: ',
if ( == '' || is Boolean) {
trace('loader data is empty or boolean')
trace('loader data seems JSON string')
data = JSON.parse(

for(var s:String in data){
trace(s, '::', data)
if(data != null){
if(data.hasOwnProperty("message") && data.hasOwnProperty("code")){
trace('loader data is error message')
if(error != null){
trace('loader data is success object')

if (success != null) {
ldr.addEventListener(Event.COMPLETE, parseData, false, 0, true)

ldr.addEventListener(IOErrorEvent.IO_ERROR, function(ev:IOErrorEvent):void{
trace('IO error', ev.text)
}, false, 0, true)

// Debug -----------------> 
ldr.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, function (e:HTTPStatusEvent) {
for each(var r:URLRequestHeader in e.responseHeaders){
trace("request header:: ",, " : ", r.value)
}, false, 0, true)
// <-----------------------

public static function SignOut(userToken: String, success: Function = null, error: Function = null): void {
var url: String ='' + 'v1' + '/users/' + 'logout'
Backendless.Call(url, URLRequestMethod.GET, null, success, error, userToken);

After little modification, i am able to login and I get new token which I save locally.

I user new token to query data table, but now i get same above error {“code”:3064,“message”:“Not existing user token. Relogin user to update your user token”}.
I have done this check 4-5 times, every times it gives same error.

Please advice what could have gone wrong.



Waiting about this.
Please reply.


Hi Tushar!

We are working on this issue.

Hi Kate,

Thanks for updating.

Glad to know that it is from server side and not our coding problem.
Now I can work on other stuff. :slight_smile:
Will be waiting for solution to this.


Hi Tushar,

Here is the pure working example, you can test it in your Terminal with curl (this is my test application and test user):
Login request:

curl \
-H application-id:BBDAAC19-D8E0-3AAE-FF03-90203AAC7F00 \
-H secret-key:4E70E147-789E-DA3C-FFBD-D0AA9C849500 \
-H application-type:REST \
-H Content-Type:application/json \
-d '{"login":"","password":"qwerty"}' \
-X POST [url=][/url]

In response I get:


From where I take user-token value and use it in logout request:

curl \
-H application-id:BBDAAC19-D8E0-3AAE-FF03-90203AAC7F00 \
-H secret-key:4E70E147-789E-DA3C-FFBD-D0AA9C849500 \
-H application-type:REST \
-H user-token:BAD52CFC-4A15-AD14-FF54-1FF4AE323A00 \
-X GET [url=][/url]

Now my user is logged out and I can login again successfully and get a new user-token.

How is this example different from what you do? Could you please provide your REST requests in the same form here?

Hi Sergey,

Thanks for you efforts, but the issue was with my coding.
By mistake previous token was also stored in a variable in some other class which was causing this issue.
Sorry guys!