Azure-Samples / Azure-Samples/azure-maps-leaflet
Expired anonymous token handling error "Token Expired, Try again"
- Dominant language
- TypeScript
- Stars
- 22
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
> Please provide us with the following information:
> ---------------------------------------------------------------
### This issue is for a: (mark with an `x`)
```
- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
```
### Minimal steps to reproduce
- Anonymous auth method, retrieve map access token from Azure Maps via App Service and System Managed Identity.
- Put tab in background.
- Wait for token to be expired ~24hrs?.
- Move map and request for tiles.
### Any log messages given by the failure
Error: "Token Expired, Try again"
### Expected/desired behavior
Should handle an expired token rather than throwing an exception.
### OS and Version?
> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
- macOS 14.1
- MS Edge 118.0.2088.76
### Versions
>
### Mention any other details that might be useful
AAD might still give out a valid token (with 5 seconds left of validity) which could expire by the time the front end receives it. We cannot control or force a fresh token from AAD so expired tokens should be handled by the map library instead - auto retry or whatever rather than just throwing exception.
See problem line where it gives up:
https://github.com/Azure-Samples/azure-maps-leaflet/blob/7d9786a050549e440ddb78252949689f03215574/src/internal/AuthenticationManager.ts#L264
> ---------------------------------------------------------------
> Thanks! We'll be in touch soon.
Contributor guide
Assessment
This issue has not been assessed yet.