jeffsui Posted July 9, 2016 Share Posted July 9, 2016 I have written a workflow that will query an exchange server and pull out a "today" list of appointments meeting etc and its pretty cool - except I built it for our internal exchange system with lots of nice hardcoded things. I'd like to open this workflow up to the outside world - and as such - I need to store a users password and username. I can do this in the plist but I was wondering if there is a way to pull exchange credentials out of the keychain so that I don't need to go through the configuration step. Any ideas? Link to comment
deanishe Posted July 9, 2016 Share Posted July 9, 2016 (edited) You can use the security command line program to set/get passwords in the keychain. security add-generic-password -a 'account name' -s 'workflow.bundle.id' -w 'password' will set the password for account account name to password for service workflow.bundle.id. security find-generic-password -a 'account name' -s 'workflow.bundle.id' -g will retrieve the above password. Account name is the identifier for the password, like the username or email address. Service is an identifier for the application/website storing the password. Your bundle ID is a good choice here. Might be worth mentioning that older versions of OS X (Lion and earlier, IIRC) don't support the -g option on find-generic-password. Edited July 9, 2016 by deanishe Link to comment
rice.shawn Posted July 13, 2016 Share Posted July 13, 2016 To follow up, if you are writing it in Python and using Dean's library, he's made some nice wrappers around these commands for ease. If you're writing it in PHP and using Alphred, then the same sort of wrappers exist. If you're doing it otherwise, then you'll have to access the commands yourself. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now