amazon-archives / amazon-cognito-auth-js

The Amazon Cognito Auth SDK for JavaScript simplifies adding sign-up, sign-in with user profile functionality to web apps.
Apache License 2.0
424 stars 232 forks source link

Any plans on support for react native? #133

Open justinwaite opened 6 years ago

justinwaite commented 6 years ago

Hello, I just spent the last couple of days hacking my way around using the hosted ui with React Native in an Expo app. Recently, the Amplify library has added support for web react to use the Hosted UI using this library (amazon-cognito-auth-js). Since it appears that Amplify is relying on this package for usage of the Hosted UI, in order to add support for using the Hosted UI with React Native in Amplify, it seems that it would be necessary that some support is added for React Native in this library. Namely:

  1. Storage options. Right now this library will use localStorage if available, otherwise it will default to memory storage. In order for full functionality with React Native, we would need to add an option for AsyncStorage much like the amazon-cognito-identity-js library does (see StorageHelper-rn.js and package.json for that project to see how they implement it). At the very least, we should allow Amplify to provide a storage class on the constructor in order to override the storage helper that comes with this package, much like amazon-cognito-identity-js does.
  2. Using window.location. This one is a bit trickier because your implementation of how to do this depends on your app. For me, I use the AuthSession class provided by Expo in order to call out to the oauth endpoints and it handles the callbacks. This has turned out to be a great solution for me, but obviously will only work for those using Expo (and many people do). It would be nice if we could allow the developer to overwrite the implementation for making the oauth calls. This topic definitely needs discussion.

I would love to offer my assistance if this is something that can be supported here. If this library does not plan on supporting React Native, then it is necessary that all of this logic be duplicated and redone for Amplify, which to me seems like a waste of everyone's time since it is all done here.

AMiggel commented 6 years ago

Help me please: https://github.com/aws/amazon-cognito-auth-js/issues/134