WIP FEATURE: Show authentication screen if needed
If the server throws AuthenticationRequired exceptions, those should also be handled by the client.
- [x] Provide additional custom information in error response
- [ ] Provide authentication url in response for WebRedirect tokens
- [x] Show all error details in console output
- [ ] Show dialog to handle re-authentication
- [ ] Retry previous request via https://www.apollographql.com/docs/react/data/error-handling/#retrying-operations
@kdambekalns with Johannes help I implemented a custom FlowError transformer for the GraphQL adapter.
I can now provide additional information based on the type & code of the security errors.
This works well, but I'm currently not sure how I get the authentication url from the WebRedirect entry point inside the FlowErrorTransform.
Do you have an idea?
This works well, but I'm currently not sure how I get the authentication url from the
WebRedirectentry point inside theFlowErrorTransform. Do you have an idea?
Since the WebRedirect can build the needed URI, I'd say adding a new method there to provide the needed value would be the way to go. But you'd need "the request" for that, at least with the current code. Not sure how well that plays with the GrapQL request that would trigger such an error…
For the use case I need this for, no WebRedirect is involved, though. Have you thought about that? Or would I need to set up a "fake token" to play along? If so, how would it know which token to use? It would at least need to check the state of the token (and only use it's entrypoint when it's not authenticated.)