Your code really helped me a lot!
When I add 'kSecAttrAccessGroup as String: "com.apple.managed.vpn.shared"' to the query parameters, I always get a -50 error. This issue has troubled me for a long time, and I didn't realize that this parameter could be ignored.
Topic:
App & System Services
SubTopic:
Networking
Tags: