Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

headerBasedAuth not updating the headers with new values #666

Open
chrisharrison opened this issue Aug 20, 2021 · 1 comment
Open

headerBasedAuth not updating the headers with new values #666

chrisharrison opened this issue Aug 20, 2021 · 1 comment

Comments

@chrisharrison
Copy link

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Using the following config when creating a client:

const client = new AWSAppSyncClient({
  url: config.AppSync.aws_appsync_graphqlEndpoint as string,
  region: config.AppSync.aws_appsync_region,
  auth: {
    type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS,
    jwtToken: async () =>
      (await Auth.currentSession()).getIdToken().getJwtToken(),
  },
  disableOffline: true,
});
  disableOffline: true,
});

When a subscription is created a websocket is established. Under some circumstances (network disruption, VPN switching etc) a new websocket connection is established. But the authorization header is not updated. If the access token has since expired then Appsync will return:

[{errorType: "UnauthorizedException", message: "Token has expired."}]

What is the expected behavior?

The authorization header should use the token returned by the jwtToken function in the Appsync client config.

@paulich
Copy link

paulich commented Sep 14, 2022

We've run into the same issue and it seems like the fix in #667 solves it. Can this be added to the libraries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants