-
Notifications
You must be signed in to change notification settings - Fork 472
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
Implementing refresh and needsRefresh when using chime sdk js and aws sdk js v3 #2543
Comments
AWS session credentials are tied to a specific expiration date after which the service will return the If, for example, you are using Cognito and their
If you are retrieving your AWS session credentials from another custom source such as your own identity provider, you will need to implement the Here is an example that implements those functions calling AWS Cognito to retrieve new credentials.
|
Hello, Thanks for you reply. I am using Amplify which will fetch the credentials when the user logs in. I don't think I have access to AWS namespace. The credentials config options for ChimeSDKMessagingClient seems to take a function would this be called whenever the credentials get expired? |
Under the hood, Amplify integrates with AWS Cognito so the credentials are automatically refreshed when calling So you will need to implement the credential provider which will call You can refer to this comment as an example of how you can implement such a provider. Instead of using
you can instead use
in order to pull the credentials from Amplify and Cognito. |
understood, thanks. |
@kmai-amazon I tried approach mentioned in your comment link and it didn't work.
Thanks for help. |
Hello @admin-zh, The way I did it is pass a function which is credential provider to the credentials property instead of an object with credentils, the credentials object that is returned by Auth.currentCredentials seems to include an expiration property (I haven't verified, this assumption is based on the return type) but identity pool response when amplify fetches the credentials includes the expiration property
|
@deepaktammali thanks a lot, I tried it and it worked like charm!! |
What are you trying to do?
I am using amazon-chime-sdk-js for a messaging application, but after some idle time I get expired token error message.
Messaging Session failed to resolve endpoint: ExpiredTokenException: The security token included in the request is expired
How can the documentation be improved to help your use case?
In Amazon Chime SDK Messaging documentation, It is mentioned If we implement refresh and needsRefresh methods, then aws chime sdk js would automatically refresh the credentails.
https://docs.aws.amazon.com/chime-sdk/latest/dg/handle-disconnects.html
I would like to understand the implementation of refresh and needsRefresh methods so that amazon-chime-sdk-js would automatically refresh the tokens.
What documentation have you looked at so far?
I have looked at the Readme.MD file and also searched for it but was not able to find a solution.
Thank you.
The text was updated successfully, but these errors were encountered: