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.43k stars 2.13k forks source link

Access Auth Sessions created in Amplify-Swift SDK when migration to React Native #12904

Open AndyMeagher opened 9 months ago

AndyMeagher commented 9 months ago

Is this related to a new or existing framework?

React Native

Is this related to a new or existing API?

Authentication

Describe the feature you'd like to request

I am currently migrating a Native iOS codebase using the Amplify Swift SDK for authentication to a React Native codebase. I am using this SDK for authentication in React Native and would like the User's Auth Session to persist in the update of the codebase and not Log the user out.

This doesn't currently seems to be possible.

Describe the solution you'd like

If the React Native package uses the Swift SDK under the hood, it would be ideal for the Auth Session to just persist and be valid. (Assuming the Client IDs match).

Either that or provide a way to access the storage mechanism that the SwiftSDK uses...the Keychain?

Describe alternatives you've considered

Forcing the user to re-authenticate

Additional context

I am open to alternative work arounds, thank you!

HuiSF commented 9 months ago

Hi @AndyMeagher Thanks for bringing this to our attention. Amplify Swift uses Keychain as the secure store of auth tokens under the hood. Amplify JS React Native is working differently, and it doesn't have the functionality operating over the Keychain. There is currently no easy path to achieving the token migration between Amplify Swift and JS, unfortunately. I will mark this as a feature request.