EddyVerbruggen / nativescript-fingerprint-auth

:nail_care: 👱‍♂️ Forget passwords, use a fingerprint scanner or facial recognition!
MIT License
134 stars 33 forks source link

FaceID Auth Issues with two identical Apps (different ID) #84

Closed Cateye82 closed 4 years ago

Cateye82 commented 4 years ago

We are building enterprise apps on nativescript/angular 6.5.2 IOS with the plugin version 7.0.2. If we build two apps (almost identical) but with different ID, BundleName, BundleSignature and BundleIdentifier there is a strange thing going on. I can login with FaceID on the first app I install, but as soon as the second app is installed, FaceID is not working on one of those two. The error code is always "-1004".

Here is the code that i am using:

public onFingerprintLogin() {
        console.log('onFingerprintLogin');
        console.log('checking database...');
        this.fingerprintAuth.didFingerprintDatabaseChange().then(changed => {
            if (changed) {
                // fingerprint database has changed
                console.log('... database changed!');
            } else {
                // call the fingerprint scanner
                console.log('... database ok, calling fingerprint method!');
                this.fingerprintAuth.verifyFingerprintWithCustomFallback({
                    message: this.languagePipe.transform('ENTERFINGERPRINT') // optional
                }).then(
                    () => {
                        console.log('Auth successful!');
                        this.onLogin(getString('username'), getString('password'), true);
                    },
                    (error) => {
                        console.log('Auth failure!');
                        console.log(error);

                        if (error && error.code) {
                            if (error.code === -1004) {
                                this.fingerprintAuthReAuth = false;
                                this.fingerprintAuthReAuthError = true;
                            }
                        }
                    }
                );
            }
        });
}

What am I doing wrong. Thank you for your support and the great plugin.

pradumnk-mahanta commented 4 years ago

+1

Cateye82 commented 4 years ago

Sorry for the late answer but I had to be sure. If you have two (or more) different projects, you should compile them from different folders. Nativescript Angular takes the folder name for "Product Name" inside XCODE. If this is the same name the fingerprint wont work as expected, even if the id is different.

You can either place the second project in a different folder, or manually change the "Product Name" inside XCODE and compile it from there.

Screenshot 2020-10-14 at 16 28 43

Inside the screenshot you see the changed "Product Name", which is in my case "red". Then it worked for me.

Unfortunately I have to compile my "red" version manually now. Anybody knows a way to change that by a config file automatically?