You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use this helper to create a credential chain of your own.
791
791
792
+
A credential chain is created from a list of functions of the signature () => Promise<[AwsCredentialIdentity](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-types/Interface/AwsCredentialIdentity/)>,
793
+
composed together such that the overall chain has the **same** signature.
794
+
795
+
That is why you can provide the chained credential provider to the same field (`credentials`) as any single provider function.
796
+
797
+
All the providers from this package are compatible, and can be used to create such a chain.
798
+
799
+
As with _any_ function provided to the `credentials` SDK client constructor configuration field, if the credential object returned does not contain
800
+
an `expiration` (type `Date`), the client will only ever call the provider function once. You do not need to memoize this function.
801
+
802
+
To enable automatic refresh, the credential provider function should set an `expiration` (`Date`) field. When this expiration approaches within 5 minutes, the
803
+
provider function will be called again by the client in the course of making SDK requests.
804
+
805
+
To assist with this, the `createCredentialChain` has a chainable helper `.expireAfter(milliseconds: number)`. An example is included below.
0 commit comments