amazon-cognito-auth-js
amazon-cognito-auth-js copied to clipboard
LaunchUri override is not working on 1.3.2
Environment:
- amazon-cognito-auth-js: 1.3.2
- react-native: 0.58.1
I tried to use this project on react-native. and tried to use "LaunchUrl override functionality". My code is something like this:
import { Linking } from 'react-native';
import { CognitoAuth } from 'amazon-cognito-auth-js';
const config = {
// ... other options here
LaunchUri: (uri) => Linking.openURL(uri),
};
const client = new CognitoAuth(config);
But, LaunchUrl persists refer to window.open. It seems not working on 1.3.2.
So, I finally found the issue that the /lib folder still refer to 1.3.1.
I wonder you just forgot to replace under /lib when publishing 1.3.2...?
Thanks.
I am able to override the LaunchUri with react-native by setting LaunchUri like this:
const config = {
// ... other options here
LaunchUri: async url => {
const result = await WebBrowser.openAuthSessionAsync(url, signInUrl);
// do stuff with the result
}
Note that I am using Expo.WebBrowser instead of Expo.Linking so that my app opens a web browser within the app instead of kicking the user out to the device's browser app.