Graphql-flutter: Get HTTP status code in ErrorLink

Created on 22 Sep 2020  路  3Comments  路  Source: zino-app/graphql-flutter

Our GraphQL backend is built to respond with 403 on authentication error. In that case I would like the Flutter app to throw away the old API token and redirect to a sign in screen. I tried to do this with ErrorLink, and it does catch the error. But I've not found a way to extract the HTTP status code from the ErrorResponse. Is there any way to do that?

Most helpful comment

In v4 you should be able to get HttpLinkResponseContext from the response, which has the status code

All 3 comments

Ran into exactly the same problem.
Going beyond the original question, what's the best way to implement token renewal and general retry for gateway failures in graphql 3.1.0?

To answer half of my question, https://github.com/felangel/fresh/tree/master/packages/fresh_graphql seems to work well for token renewal.

In v4 you should be able to get HttpLinkResponseContext from the response, which has the status code

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vanelizarov picture vanelizarov  路  3Comments

campanagerald picture campanagerald  路  3Comments

juicycleff picture juicycleff  路  4Comments

javi11 picture javi11  路  3Comments

dopecoder picture dopecoder  路  4Comments