Refresh expired JWT token for ACL access

Moved from GitHub dgraph-js/56

Posted by danielmai:

When I run yarn && yarn test the bank.spec.ts test fails with this error about JWTs:

  ● bank › should successfully perform transaction load test

    16 UNAUTHENTICATED: unable to parse jwt token:Token is expired

dgraph-js should do the following like dgo and dgraph4j already do:

  • check if the JWT is expired in every request and, if the JWT is expired, request a new JWT using the refresh token.

danielmai commented :

The test does not pass with the test cluster as configured in dgraph/dgraph/docker-compose.yml. Specifically, when the ACL access TTL is shortened from the default, then the client should use the refresh token to request another access token.

dgraph alpha ...  --acl_access_ttl 3s