Posted on 11-26-2021 12:26 AM
spent 2 hours to figured out how to enable Okta extension for Safari, post it here if someone need it.
#!/bin/zsh
# Safari Extensions File Path(my is macos 11.6):
# ~/Library/Containers/com.apple.Safari/Data/Library/Safari/WebExtensions/Extensions.plist
username=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
cd /Users/$username/Library/Containers/com.apple.Safari/Data/Library/Safari/WebExtensions/
enabled=$(plutil -extract "okta\.ExtensionLauncher\.Extension\.WebExtension (B7F62B65BN)".Enabled raw Extensions.plist)
if [ "$enabled" = "false" ]; then
plutil -replace "okta\.ExtensionLauncher\.Extension\.WebExtension (B7F62B65BN)".Enabled -bool "Yes" Extensions.plist
jamf displayMessage -message "Okta Extension is enabled for Safari, please quit and reopen Safari."
else
echo "Okta Extension already enabled."
fi
Posted on 11-26-2021 03:07 AM
Click Open Safari in the separate window. Enable the extension by navigating to Safari > Preferences > Extensions in your toolbar at the top left corner of your screen and checking the box for the Okta Extension App. Sign into the Okta End-User Dashboard to complete the setup.
Posted on 12-02-2021 10:27 PM
@Rowan45 you are right, we can manually enable it. but for hundreds of computers we need a better solution.
10-20-2022 10:58 AM - edited 10-20-2022 11:00 AM
You sir, have done this world a great favor.
10-25-2022 08:34 AM - edited 10-25-2022 01:43 PM
Does this still work on Monterey? When running as script from terminal it works, but after uploading to Jamf and executing a policy it returns an error: "CFURLCopyResourcePropertyForKey failed because it was passed a URL which has no scheme"
Posted on 03-24-2023 04:24 AM
it should work, maybe you need full disk access to run the script from jamf policy, the Safari folder is protected by SIP.
Posted on 03-28-2023 01:07 PM
Worked like a charm, thanks Steven