I’m working on user logout, the “Backendless.UserService.logout()” method is in backendless API, so in my client side i’m not using the logout that is in backendless sdk, it become a API service…
the problem is whenever the user is logged out automatically by the backendless session timeout,
and in the client side the user send a request to logout , an error occur : “WebException: No Location header found for 302” .
Expected response:
Http Response Message.status code: 302 with a message :user already logged out…
any solution for this problem ?
Is this the exact wording of the error?
No Location header found for 302
I have edited the forum, “WebException: No Location header found for 302” is the error
and yes this is the exact wording of it
Does the same error happen if you invoke the service from backendless console?
console invoke:
302 - Session timeout. Url: http://pickapp.com/api/5FB0EA72-A363-4451-FFA5-A56F031D6600/F1627532-A44A-4FD3-9FBD-9564BFAD7D13/page/session_expiration/index.html (3048)
body:
{
“code”: 3048,
“message”: “Session timeout. Url: http://pickapp.com/api/5FB0EA72-A363-4451-FFA5-A56F031D6600/F1627532-A44A-4FD3-9FBD-9564BFAD7D13/page/session_expiration/index.html”,
“errorData”: {}
}
What is the name of the API service and method you’re invoking?
UserBusiness logout
the problem is when the user-token is outdated. so I set the inactivity timeout value to 1 sec just to test what happen if I send an outdated user token and this is the result
Or
note: if I invoke the method with valid user token it works, and if it is without user token at all ,it works also, but in the case of invalid user token the problem occur
It sounds like you need to add some code to check if the user token is valid. And when it is not, then handle it accordingly. Here’s the API to check if the user token is valid or not:
https://backendless.com/docs/js/users_login.html#validating-user-login
I have tried Backendless.UserService.isValidLogin() the same problem occur when i set invalid token or outdated token it doesn’t return false for outdated token
it seems like backendless business logic checks the token before invoking the method, am i right ?
you can test it in UserBusiness validLoggedIn
Yes, it seems that way. In this case, how about simply handling the 302 error on the client side? If the token is invalid, then the logout is not needed, you simply need to reset/remove the token in the client app, right?
yes it will work in that way, and it will be my last solution.
but is there any way to manually setting user token to isValidLogin in backednless dotnet sdk?
cause i’m using login as an API service, so technically isValidLogin in front-end will always return false.
Please clarify this:
Did you mean:
a) Set user token so that isValidLogin
uses that token to check?
b) Set user token in order to erase it?
a
You would do it like this: