zino-hofmann / graphql-flutter

A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
https://zino-hofmann.github.io/graphql-flutter
MIT License
3.25k stars 620 forks source link

Could not verify JWT: JWTIssuedAtFuture #1085

Closed thanhnhan111093 closed 2 years ago

thanhnhan111093 commented 2 years ago

used version: firebase_auth: 3.3.11 graphql_flutter: 5.0.0

I use firebase_auth + graph for my system, but I get the following error

Query Error: OperationException(linkException: null, graphqlErrors: [GraphQLError(message: Could not verify JWT: JWTIssuedAtFuture, locations: null, path: null, extensions: {path: $, code: invalid-jwt})])

`final HttpLink _httpLink = HttpLink( _endpoint, );

final WebSocketLink _websocketLink = WebSocketLink( _wsEndpoint, config: SocketClientConfig( autoReconnect: true, inactivityTimeout: Duration(seconds: 30), ), ); final AuthLink _authLink = AuthLink( getToken: () async { String _jwt = await storage.read(key: "token"); return 'Bearer ' + _jwt; }, );

final Link _link = _authLink.concat(_httpLink).concat(_websocketLink); return GraphQLClient(cache: GraphQLCache(store: InMemoryStore()), link: _link);`

I tried researching on google and checked the server time. Time on the server is not delayed. Same token and request I also tried on web and postman, all working fine. So I think the problem is with this plugin. Team, please help me check this issue, Thank Team.

thanhnhan111093 commented 2 years ago

sorry I found the cause in this issue, because the time difference between 2 servers (hasura and auth) is ~20s