fix: Intercept redirection to /settings/clients/limit-exceeded
page
#955
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In some edge-case scenario, the app may incorrectly open a cozy-app even if the OAuth client limit is exceeded
This may happen if the
cozy.oauthclients.max
flag is not set when the app starts but it is set just after that. In that case, the limit check won't be done when the user tries to open a cozy-app because flags are not updated after the app start. This is an edge case of a8ad127This may also happen if some network errors occur when querying the cozy-stack for doing the check. In that case the app will fallback to an "under the limit" scenario
In those cases, the app will tries to open the cozy-app and then the cozy-stack will return a
302
to/settings/clients/limit-exceeded
With current implementation, this
302
will be intercepted by theReloadInterceptorWebView
and redirected to an InAppBrowser instead of theOauthClientsLimitExceeded
popupNote that this happens only if app is served by the cozy-stack and not by the HttpServer
To prevent this we want to detect this scenario in the
ReloadInterceptorWebView
and open theOauthClientsLimitExceeded
popup