awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
919 stars 266 forks source link

`auth` option of `createAuthLink` of `aws-appsync-auth-link` cache the `jwtToken`? #622

Open yaquawa opened 3 years ago

yaquawa commented 3 years ago

considering this piece of code.

const url = 'xxx'

const jwtToken = async () => {
  return await getJwtToken()
}

const auth = {
  type: 'AMAZON_COGNITO_USER_POOLS',
  jwtToken,
}

const userPoolsAuthLink = createAuthLink({ url, region, auth })

the jwtToken is a function, which should be called for every request, but seems like the package aws-appsync-auth-link only called it once at the first time. This will cause problem when the jwtToken expired.

edemagbenyo commented 2 years ago

Any updates on this?