Support Topics Documentation Slack YouTube Blog

Cloudless service without user-token

Is there a way to create a Cloudless Service without it checking the user-token?
I am calling the service with my JS API key.
I have created a cloudless service but Im getting a Session Timeout error.

Hi Bennie,

The token is checked by the core system before the request reaches your service. When a token is expired, there is a general error as you have seen. The proper mechanism for handling this error would be one of the following:

  1. Use the Logout API to clear the token and repeat the request.
  2. Redirect the user to the login screen so the token is updated.

Regards,
Mark

Thank you.
Using the Logout API worked for me.

I am new to Backendless and am blown away by its potential. I have been wrestling through codeless and am making progress.

Forgive me if this is the wrong thread.

For the Logout “on click event” I used the following:

Screen Shot 2021-02-17 at 1.07.29 PM

I assumed that the session variables would be cleared, but it doesn’t seem to do that.

After the app reaches the session timeout (3600) I get the following error when I try to run a page. I have been able to workaround it by clearing the browser history.

Can not render page due to error: "Session timeout. Url: https://api.backendless.com/C0080AC2-DFD5-151C-FFE5-6A6E57A59000/F60BD0A5-C374-4019-AF0E-1EAE749FD89E/page/session_expiration/index.html"

ResponseError@https://backendlessappcontent.com/C0080AC2-DFD5-151C-FFE5-6A6E57A59000/A3814D5F-3A80-40B8-8CEF-8A273AC04CD1/files/ui-builder/library/sdk/sdk.js:14:168289

checkStatus@https://backendlessappcontent.com/C0080AC2-DFD5-151C-FFE5-6A6E57A59000/A3814D5F-3A80-40B8-8CEF-8A273AC04CD1/files/ui-builder/library/sdk/sdk.js:14:170431

promiseReactionJob@[native code]

Should I add something to delete the session?

Hi Jim,

Welcome to the Backendless community and thank you for your kind words.

It would be better to create a new topic for every issue - it will help us and others to keep the conversations more focused.

Could you please clarify the following comment:

What exactly happens in the app when it “reaches the session timeout”?

Regards,
Mark

10-4. What I mean is after 60 minutes (declared in the user login settings), when I try to preview any of the pages, including the login page, I get the error.

It happened in both Chrome and Edge browsers.

Also, thank you for the quick reply and the tutorial videos. Great job!

Thanks, Jim. So that we can reproduce the problem, I’d like to confirm the steps:

  1. You run the login page in the preview mode.
  2. User logs in and the logic navigates to the WellnessHub page
  3. 3600 seconds later, you try opening a page in preview and you get the error you described.

If I got it right, could you please let me know what page you run in step 3?

Regards,
Mark

Not quite. Here are the steps:

  1. Login
  2. Go to WellnessHub page
  3. Logout
  4. After 60 minutes or so, when I try to preview a page, the error occurs and I cannot preview a page.
  5. Workaround: clear history, cache, etc.

What I expected is that when the session times out, I would be directed to the login (index) page, but it does not.

Let me know if you have any more questions.

Thanks again!

Browser error code again for simplicity:

Can not render page due to error: "Session timeout. Url: Backendless session expiration page"

ResponseError@https://backendlessappcontent.com/C0080AC2-DFD5-151C-FFE5-6A6E57A59000/A3814D5F-3A80-40B8-8CEF-8A273AC04CD1/files/ui-builder/library/sdk/sdk.js:14:168289

checkStatus@https://backendlessappcontent.com/C0080AC2-DFD5-151C-FFE5-6A6E57A59000/A3814D5F-3A80-40B8-8CEF-8A273AC04CD1/files/ui-builder/library/sdk/sdk.js:14:170431

promiseReactionJob@[native code]

This helps, thank you. Does it happen with every page in step 4? I assume if you start over with Login, it works just fine.

It happens with every page, including Login.

Thank you. I created an internal ticket (for reference purposes it is BKNDLSS-24159).

As a temporary workaround until the problem is fixed, there are two options:

  1. you can add the following logic in the “On App Enter” event for all your pages:

It will definitely cause an inconvenience since you will need to relogin every time

OR

  1. You could increase the session timeout so the error doesn’t happen as frequently.

Regards,
Mark

That will work, thank you sir.

Happy coding :slight_smile:

Hello @Jim_Gates

We’ve just updated cloud servers with a fix for the issue you described above. Could you kindly let us know whether fix works for you well?

Regards,
Inna