'How to enable Touch ID in prompt for password using Applescript in Objective C

I am using a solution from @CarlosP in my objective C app to execute a script as administrator.

Link is above but basically it's doing this:

NSDictionary *errorInfo = [NSDictionary new];
NSString *script =  [NSString stringWithFormat:@"do shell script \"%@\" with administrator privileges", fullScript];

NSAppleScript *appleScript = [[NSAppleScript new] initWithSource:script];
NSAppleEventDescriptor * eventResult = [appleScript executeAndReturnError:&errorInfo];

It works great, but it doesn't enable/allow Touch ID. Is there a way for me to do that within the scope of NSAppleScript?



Solution 1:[1]

You can enable Touch ID authorization for sudo. Check details here and here.

Add auth sufficient pam_tid.so to /etc/pam.d/sudo file. In you Applescript remove with administrator privileges and use sudo in your shell script.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sers