aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.38k stars 2.1k forks source link

Fetching Auth Session with / without AWS Credentials #13377

Open pri-techginity opened 1 month ago

pri-techginity commented 1 month ago

Is this related to a new or existing framework?

No response

Is this related to a new or existing API?

Authentication

Is this related to another service?

No response

Describe the feature you'd like to request

Sometimes, when using fetchAuthSession(), we only want to get the access tokens without requesting valid AWS Access Credentials from Identity Pool.

Describe the solution you'd like

Adding a tokensOnly flag should do the trick. But not sure how it fits in the entire amplify ecosystem

fetchAuthSession({
tokensOnly: true
})

Describe alternatives you've considered

Alternative is to keep using fetchAuthSesion and let it actively get the fresh credentials from identity pool. Alternatively, since amplify stores everything in local storage, one could obtain it from there too.

Additional context

I'm using amplify in my react application.

Is this something that you'd be interested in working on?

cwomack commented 1 month ago

Hey, @pri-techginity and thanks for opening this issue. We are currently looking into a solution for this and will follow up with any questions or updates when we have them. Thanks!