According to the documentation, if I define a time in cuba.rest.client.tokenExpirationTimeSec = 300, “300 seconds”. in web-app.properties, the event from the web component app-cuba call on-cuba-token-expired will execute the method _handleTokenExpired when 300 seconds was passing, right!!!
in the follow example it will jump the alert(‘token Expired’) after 300 seconds into the app. . . . . I don´t know why but it isn´t working. . . . . some one can tell me something about it. . . thank a lot!
This handler will be invoked when Unauthorized 401 error received from REST API in response to some explicit request. There is no ping / keep alive mechanism which automatically will call this handler.
ok, if I define cuba.rest.client.tokenExpirationTimeSec = 180, after this time I am going to recive a Unauthorized 401 error when I try to use REST API?. . . . . can I say token Expiration Time is gonna be 180 seconds and can I say this like " cuba.rest.client.tokenExpirationTimeSec = 180?
I have missed something or there are something wrong in my web-app.properties . . .
That is correct. Your web-app.properties also looks fine.
Are you sure you send the token? (It happens automatically if you use cuba-rest-js / data components).
Also you have rest anonymous mode enabled so if you do not login you’ll never get 401.