Sometime get 3048 error

Sometime I got error 3048 when fetching entity when I am not authorised.

For this entity is granted unauthorised access
The only solution is to remove app and reinstall it but this is not the way to handle it on production build

You are getting this errors, because you make requests from logged in user, and for this user user token was expired, you should handle this errors and when it is occurs suggest to your customer login one more time

Why and how should I ask user to login one more time if I need to get initial data before login?

if you got 3048, this means that have you already logged in. it may be because you call [backendless.userService setStayLoggedIn:Yes]. In this case, application remembers previous user token and makes all requests with this user token. So before login try to logout.

hm, well
I’ve tried to logout in this case and get … crash
*** Terminating app due to uncaught exception of class ‘Fault’

libc++abi.dylib: terminating with uncaught exception of type Fault

or in case I use async api i got:

Optional(FAULT = ‘3048’ [Session timeout. Url: <https://api.backendless.com/D3EE6869-99AA-73E8-FFED-40612E93F400/page/session_expiration/index.html>] <Session timeout. Url: <https://api.backendless.com/D3EE6869-99AA-73E8-FFED-40612E93F400/page/session_expiration/index.html>> )

any updates?

The same issue in my case

I faced the same

so this problem is not even iOS specific, it reproduces on Android as well

please specify exact steps to reproduce.

  1. Sign In
  2. Don’t use app for about an hour
  3. Try to fetch some data or call any request

Result -> error 3048 even for sign out

some time it happens after 5-10 minutes after last requst

When you say “Sign In”, are you talking about Backendless Console? If not, where should we sign in and using what credentials?

I mean:

Backendless.sharedInstance()?.userService.login(userName,

	password: password,

	response: { (backendlessUser: BackendlessUser?) in

	},

	error: { (fault: Fault?) in

	})

Well, 3048 is an error code for session timeout. When you do not use the app for an hour, the session times out.

Yes, but how should I handle this situation?

You could catch the error in the code and redirect the user to the login screen.

But I need to fetch initial data, which is available without session (as described in initial message of the topic)

So the problem is that you can not logout if you session expired?