amazon-cognito-auth-js icon indicating copy to clipboard operation
amazon-cognito-auth-js copied to clipboard

LaunchUri override is not working on 1.3.2

Open mitsuruog opened this issue 6 years ago • 1 comments

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.

mitsuruog avatar Mar 20 '19 04:03 mitsuruog

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.

schellack avatar Mar 21 '19 04:03 schellack