I am working on implementing mTLS authentication in my iOS app (Apple Inhouse & intune MAM managed app). The SCEP client certificate is deployed on the device via Intune MDM. When I try accessing the protected endpoint via SFSafariViewController/ASWebAuthenticationSession, the certificate picker appears and the request succeeds. However, from within my app (using URLSessionDelegate), the certificate is not found (errSecItemNotFound).
The didReceive challenge method is called, but my SCEP certificate is not found in the app. The certificate is visible under Settings > Device Management > SCEP Certificate.
How can I make my iOS app access and use the SCEP certificate (installed via Intune MDM) for mTLS requests?
Do I need a special entitlement, keychain access group, or configuration in Intune or Developer account to allow my app to use the certificate?
Here is the sample code I am using:
final class KeychainCertificateDelegate: NSObject, URLSessionDelegate {
func urlSession(_ session: URLSession,
didReceive challenge: URLAuthenticationChallenge,
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodClientCertificate else {
completionHandler(.performDefaultHandling, nil)
return
}
// Get the DNs the server will accept
guard let expectedDNs = challenge.protectionSpace.distinguishedNames else {
completionHandler(.cancelAuthenticationChallenge, nil)
return
}
var identityRefs: CFTypeRef? = nil
let err = SecItemCopyMatching([
kSecClass: kSecClassIdentity,
kSecMatchLimit: kSecMatchLimitAll,
kSecMatchIssuers: expectedDNs,
kSecReturnRef: true,
] as NSDictionary, &identityRefs)
if err != errSecSuccess {
completionHandler(.cancelAuthenticationChallenge, nil)
return
}
guard let identities = identityRefs as? [SecIdentity],
let identity = identities.first
else {
print("Identity list is empty")
completionHandler(.cancelAuthenticationChallenge, nil)
return
}
let credential = URLCredential(identity: identity, certificates: nil, persistence: .forSession)
completionHandler(.useCredential, credential)
}
}
func perform_mTLSRequest() {
guard let url = URL(string: "https://sample.com/api/endpoint") else {
return
}
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Accept")
request.setValue("Bearer \(bearerToken)", forHTTPHeaderField: "Authorization")
let delegate = KeychainCertificateDelegate()
let session = URLSession(configuration: .ephemeral, delegate: delegate, delegateQueue: nil)
let task = session.dataTask(with: request) { data, response, error in
guard let httpResponse = response as? HTTPURLResponse, (200...299).contains(httpResponse.statusCode) else {
print("Bad response")
return
}
if let data = data {
print(String(data: data, encoding: .utf8)!)
}
}
task.resume()
}
Prioritize user privacy and data security in your app. Discuss best practices for data handling, user consent, and security measures to protect user information.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
how can you authenticate a User through Biometrics with iPhone Passcode as Fallback in the Autofill Credential Provider Extension?
In the App it works without a problem. In the Extension I get
"Caller is not running foreground"
Yeah, it isn't, as it's just a sheet above e.g. Safari.
I'd like to avoid having the user setup a Passcode dedicated to my App, especially because FaceID is way faster.
Does anybody know how to achieve iOS native Auth in the extension?
Please let me know, a code sample would be appreciated.
Regards,
Mia
Topic:
Privacy & Security
SubTopic:
General
Tags:
Face ID
Touch ID
Local Authentication
Authentication Services
Hi Apple Team and Community,
We encountered a sudden and widespread failure related to the App Attest service on Friday, July 25, starting at around 9:22 AM UTC.
After an extended investigation, our network engineers noted that the size of the attestation objects received from the attestKey call grew in size notably starting at that time. As a result, our firewall began blocking the requests from our app made to our servers with the Base64-encoded attestation objects in the payload, as these requests began triggering our firewall's max request length rule.
Could Apple engineers please confirm whether there was any change rolled out by Apple at or around that time that would cause the attestation object size to increase?
Can anyone else confirm seeing this?
Any insights from Apple or others would be appreciated to ensure continued stability.
Thanks!
Having trouble decrypting a string using an encryption key and an IV.
var key: String
var iv: String
func decryptData(_ encryptedText: String) -> String?
{
if let textData = Data(base64Encoded: iv + encryptedText) {
do {
let sealedBox = try AES.GCM.SealedBox(combined: textData)
let key = SymmetricKey(data: key.data(using: .utf8)!)
let decryptedData = try AES.GCM.open(sealedBox, using: key)
return String(data: decryptedData, encoding: .utf8)
} catch {
print("Decryption failed: \(error)")
return nil
}
}
return nil
}
Proper coding choices aside (I'm just trying anything at this point,) the main problem is opening the SealedBox. If I go to an online decryption site, I can paste in my encrypted text, the encryption key, and the IV as plain text and I can encrypt and decrypt just fine.
But I can't seem to get the right combo in my Swift code. I don't have a "tag" even though I'm using the combined option. How can I make this work when all I will be receiving is the encrypted text, the encryption key, and the IV. (the encryption key is 256 bits)
Try an AES site with a key of 32 digits and an IV of 16 digits and text of your choice. Use the encrypted version of the text and then the key and IV in my code and you'll see the problem. I can make the SealedBox but I can't open it to get the decrypted data. So I'm not combining the right things the right way. Anyone notice the problem?
Topic:
Privacy & Security
SubTopic:
General
Hello, I am currently researching to develop an application where I want to apply the MacOS updates without the password prompt shown to the users.
I did some research on this and understand that an MDM solution can apply these patches without user intervention.
Are there any other ways we can achieve this? Any leads are much appreciated.
Hi everyone,
I’m currently developing an MFA authorization plugin for macOS and am looking to implement a passwordless feature. The goal is to store the user's password securely when they log into the system through the authorization plugin.
However, I’m facing an issue with using the system's login keychain (Data Protection Keychain), as it runs in the user context, which isn’t suitable for my case. Therefore, I need to store the password in a file-based keychain instead.
Does anyone have experience or code snippets for objective-c for securely storing passwords in a file-based keychain (outside of the login keychain) on macOS? Specifically, I'm looking for a solution that would work within the context of a system-level authorization plugin.
Any advice or sample code would be greatly appreciated!
Thanks in advance!
Trying to validate external reference identifiers with SecTrustEvaluateWithError Method by setting reference Ids to SecPolicyCreateSSL() & SecPolicyCreateWithProperties()
But two concerns are -
Validates for correct reference IDs but gives error for combination of wrong & correct reference Ids
398 days validity works mandatorily before reference Ids check.
Is there any other to validate external reference Ids?, which give flexibility
To pass multiple combinations of reference IDs string (wrong, correct, IP, DNS)
To validate reference ID without days validity of 398.
Please suggest. Any help here is highly appreciated.
Hello Apple Developer Community,
We have been experiencing a persistent notification issue in our application, Flowace, after updating to macOS 15 and above. The issue is affecting our customers but does not occur on our internal test machines.
Issue Description
When users share their screen using Flowace, they receive a repetitive system notification stating:
"Flowace has accessed your screen and system audio XX times in the past 30 days. You can manage this in settings."
This pop-up appears approximately every minute, even though screen sharing and audio access work correctly. This behavior was not present in macOS 15.1.1 or earlier versions and appears to be related to recent privacy enhancements in macOS.
Impact on Users
The frequent pop-ups disrupt workflows, making it difficult for users to focus while using screen-sharing features.
No issues are detected in Privacy & Security Settings, where Flowace has the necessary permissions.
The issue is not reproducible on our internal test machines, making troubleshooting difficult.
Our application is enterprise level and works all the time, so technically this pop only comes after a period of not using the app.
Request for Assistance
We would like to understand:
Has anyone else encountered a similar issue in macOS 15+?
Is there official Apple documentation explaining this new privacy behavior?
Are there any interim fixes to suppress or manage these notifications?
What are Apple's prospects regarding this feature in upcoming macOS updates?
A demonstration of the issue can be seen in the following video: https://youtu.be/njA6mam_Bgw
Any insights, workarounds, or recommendations would be highly appreciated!
Thank you in advance for your help.
Best,
Anuj Patil
Flowace Team
Can you please give me a hand with importing certificates under MacOS?
I want to connect to Wi-Fi with 802.1X authentication (EAP-TLS) using a certificate that my homebrew application imported into my data protection keychain, but the imported certificate does not show up and I cannot select the certificate.
It also does not show up in the Keychain Access app.
One method I have tried is to import it into the data protection keychain by using the SecItemAdd function and setting kSecUseDataProtectionKeychain to true, but it does not work.
Is there a better way to do this?
ID:
for id in identities {
let identityParams: [String: Any] = [
kSecValueRef as String: id,
kSecReturnPersistentRef as String: true,
kSecUseDataProtectionKeychain as String: true
]
let addIdentityStatus = SecItemAdd(identityParams as CFDictionary, nil)
if addIdentityStatus == errSecSuccess {
print("Successfully added the ID.: \(addIdentityStatus)")
} else {
print("Failed to add the ID.: \(addIdentityStatus)")
}
}
Certificate:
for cert in certificates {
let certParams: [String: Any] = [
kSecValueRef as String: cert,
kSecReturnPersistentRef as String: true,
kSecUseDataProtectionKeychain as String: true
]
let addCertStatus = SecItemAdd(certParams as CFDictionary, nil)
if addCertStatus == errSecSuccess {
print("Successfully added the certificate.: (\(addCertStatus))")
} else {
print("Failed to add the certificate.: (\(addCertStatus))")
}
}
Private key:
for privateKey in keys {
let keyTag = UUID().uuidString.data(using: .utf8)!
let keyParams: [String: Any] = [
kSecAttrApplicationTag as String: keyTag,
kSecValueRef as String: privateKey,
kSecReturnPersistentRef as String: true,
kSecUseDataProtectionKeychain as String: true
]
let addKeyStatus = SecItemAdd(keyParams as CFDictionary, nil)
if addKeyStatus == errSecSuccess {
print("Successfully added the private key.: \(addKeyStatus)")
} else {
print("Failed to add the private key.: \(addKeyStatus)")
}
}
Has anyone here encountered this? It's driving me crazy.
It appears on launch.
App Sandbox is enabled.
The proper entitlement is selected (com.apple.security.files.user-selected.read-write)
I believe this is causing an issue with app functionality for users on different machines.
There is zero documentation across the internet on this problem.
I am on macOS 26 beta. This error appears in both Xcode and Xcode-beta.
Please help!
Thank you,
Logan
WebAuthn Level 3 § 6.3.2 Step 2 states the authenticator must :
Check if at least one of the specified combinations of PublicKeyCredentialType and cryptographic parameters in credTypesAndPubKeyAlgs is supported. If not, return an error code equivalent to "NotSupportedError" and terminate the operation.
On my iPhone 15 Pro Max running iOS 18.5, Safari + Passwords does not exhibit this behavior; instead an error is not reported and an ES256 credential is created when an RP passes a non-empty sequence that does not contain {"type":"public-key","alg":-7} (e.g., [{"type":"public-key","alg":-8}]).
When I use Chromium 138.0.7204.92 on my laptop running Arch Linux in conjunction with the Passwords app (connected via the "hybrid" protocol), a credential is not created and instead an error is reported per the spec.
Hi,
I develop a Mac application, initially on Catalina/Xcode12, but I recently upgrade to Monterey/Xcode13. I'm about to publish a new version: on Monterey all works as expected, but when I try the app on Sequoia, as a last step before uploading to the App Store, I encountered some weird security issues:
The main symptom is that it's no longer possible to save any file from the app using the Save panel, although the User Select File entitlement is set to Read/Write.
I've tried reinstalling different versions of the app, including the most recent downloaded from TestFlight. But, whatever the version, any try to save using the panel (e.g. on the desktop) results in a warning telling that I don't have authorization to record the file to that folder.
Moreover, when I type spctl -a -t exec -v /Applications/***.app in the terminal, it returns rejected, even when the application has been installed by TestFlight.
An EtreCheck report tells that my app is not signed, while codesign -dv /Applications/***.app returns a valid signature. I'm lost...
It suspect a Gate Keeper problem, but I cannot found any info on the web about how this system could be reset. I tried sudo spctl --reset-default, but it returns This operation is no longer supported...
I wonder if these symptoms depend on how the app is archived and could be propagated to my final users, or just related to a corrupted install of Sequoia on my local machine. My feeling is that a signature problem should have been detected by the archive validation, but how could we be sure?
Any idea would be greatly appreciated, thanks!
I have a small command-line app I've been using for years to process files. I have it run by an Automator script, so that I can drop files onto it. It stopped working this morning.
At first, I could still run the app from the command line, without Automator. But then after I recompiled the app, now I cannot even do that. When I run it, it's saying 'zsh: killed' followed by my app's path. What is that?
The app does run if I run it from Xcode.
How do I fix this?
Topic:
Privacy & Security
SubTopic:
General
Dear Apple Developer Technical Support,
We are currently following the official Apple documentation “TN3159: Migrating Sign in with Apple users for an app transfer” to carry out a Sign in with Apple user migration after successfully transferring several apps to a new developer account.
Here is a summary of our situation:
Under the original Apple developer account, we had five apps using Sign in with Apple, grouped under a shared primary app using App Grouping.
Recently, we transferred three of these apps to our new Apple developer account via App Store Connect.
After the transfer, these three apps are no longer associated with the original primary App ID. We reconfigured individual Services IDs for each app in the new account and enabled Sign in with Apple for each.
More than 24 hours have passed since the app transfer was completed.
Now we are attempting to follow the migration process to restore user access via the user.migration flow. Specifically, we are using the following script to request an Apple access token:
url = "https://appleid.apple.com/auth/token"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
data = {
"grant_type": "client_credentials",
"scope": "user.migration",
"client_id": "com.game.friends.ios.toptop.sea", # New Services ID in the new account
"client_secret": "<JWT signed with new p8 key>"
}
response = requests.post(url, headers=headers, data=data)
However, the API response consistently returns:
{
"error": "invalid_client"
}
We have verified that the following configurations are correct:
The client_secret is generated using the p8 key from the new account, signed with ES256 and correct key_id, team_id, and client_id.
The client_id corresponds to the Services ID created in the new account and properly associated with the migrated app.
The scope is set to user.migration.
The JWT payload contains correct iss, sub, and aud values as per Apple documentation.
The app has been fully transferred and reconfigured more than 24 hours ago.
Problem Summary & Request for Support:
According to Apple’s official documentation:
“After an app is transferred, Apple updates the Sign in with Apple configuration in the background. This can take up to 24 hours. During this time, attempts to authenticate users or validate tokens may fail.”
However, we are still consistently receiving invalid_client errors after the 24-hour waiting period. We suspect one of the following issues:
The transferred apps may still be partially associated with the original App Grouping or primary App ID.
Some Sign in with Apple configuration in Apple’s backend may not have been fully updated after the transfer.
Or the Services ID is not yet fully operational for the transferred apps in the new account.
We kindly request your assistance to:
Verify whether the transferred apps have been completely detached from the original App Grouping and primary App ID.
Confirm whether the new Services IDs under the new account are fully functional and eligible for Sign in with Apple with user.migration scope.
Help identify any remaining configuration or migration issues that may cause the invalid_client error.
If necessary, assist in manually ungrouping or clearing any residual App Grouping relationships affecting the new environment.
We have also generated and retained the original transfer_sub identifiers and are fully prepared to complete the sub mapping once the user.migration flow becomes functional.
Thank you very much for your time and support!
Topic:
Privacy & Security
SubTopic:
Sign in with Apple
Tags:
Sign in with Apple REST API
Sign in with Apple
I am developing a macOS application (targeting macOS 13 and later) that is non-sandboxed and needs to install and trust a root certificate by adding it to the System keychain programmatically.
I’m fine with prompting the user for admin privileges or password, if needed.
So far, I have attempted to execute the following command programmatically from both:
A user-level process
A root-level process
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/cert.pem
While the certificate does get installed, it does not appear as trusted in the Keychain Access app.
One more point:
The app is not distributed via MDM.
App will be distributed out side the app store.
Questions:
What is the correct way to programmatically install and trust a root certificate in the System keychain?
Does this require additional entitlements, signing, or profile configurations?
Is it possible outside of MDM management?
Any guidance or working samples would be greatly appreciated.
Hi
https://appleid.apple.com/auth/authorize?client_id=com.adobe.services.adobeid-na1.web
shows:
invalid_request
But https://appleid.apple.com/auth/authorize?client_id=xrqxnpjgps
shows:
invalid_client
I've created a Primary App ID and ticked "Sign In with Apple".
I've created a Service ID and ticked "Sign In with Apple" (identifier is xrqxnpjgps).
When I click "Configure" for the "Sign In with Apple" of the Service ID, it is linked to the Primary App ID.
Why do I get an invalid_client error?
I've contacted the support by mail, and have been redirected here, does someone here have the ability/access/knowledge/will to figure out the cause and then tell me?
Regards
Topic:
Privacy & Security
SubTopic:
Sign in with Apple
I am writing a MacOS app that uses the Apple crypto libraries to create, save, and use an RSA key pair. I am not using a Secure Enclave so that the private key can later the retrieved through the keychain. The problem I am running into is that on my and multiple other systems the creation and retrieval works fine. On a different system -- running MacOS 15.3 just like the working systems -- the SecKeyCreateRandomKey function appears to work fine and I get a key reference back, but on subsequent runs SecItemCopyMatching results in errSecItemNotFound. Why would it appear to save properly on some systems and not others?
var error: Unmanaged<CFError>?
let access = SecAccessControlCreateWithFlags(kCFAllocatorDefault,
kSecAttrAccessibleWhenUnlockedThisDeviceOnly,
.biometryAny,
&error)!
let tag = TAG.data(using: .utf8)! // com.example.myapp.rsakey
let attributes: [String: Any] = [
kSecAttrKeyType as String: KEY_TYPE, // set to kSecAttrKeyTypeRSA
kSecAttrKeySizeInBits as String: 3072,
kSecPrivateKeyAttrs as String: [
kSecAttrIsPermanent as String: true,
kSecAttrApplicationTag as String: tag,
kSecAttrAccessControl as String: access,
],
]
guard let newKey = SecKeyCreateRandomKey(attributes as CFDictionary, &error) else {
throw error!.takeRetainedValue() as Error
}
return newKey
This runs fine on both systems, getting a valid key reference that I can use. But then if I immediately try to pull the key, it works on my system but not the other.
let query = [ kSecClass as String: kSecClassKey,
kSecAttrApplicationTag as String: tag,
kSecReturnRef as String: true, ]
var item: CFTypeRef?
let status = SecItemCopyMatching(query as CFDictionary, &item)
let msg = SecCopyErrorMessageString(status, nil)
if status == errSecItemNotFound {
print("key not found")
}
guard status == errSecSuccess else { print("other retrieval error") }
return item as! SecKey
I've also tried a separate query using the secCall function from here (https://developer.apple.com/forums/thread/710961) that gets ALL kSecClassKey items before and after the "create the key" function and it'll report the same amount of keys before and after on the bugged system. On the other machines where it works, it'll show one more key as expected.
In the Signing & Capabilities section of the project config, I have Keychain Sharing set up with a group like com.example.myapp where my key uses a tag like com.example.myapp.rsakey. The entitlements file has an associated entry for Keychain Access Groups with value $(AppIdentifierPrefix)com.example.myapp.
The Core Problem
After Users sign out from the App, the app isn’t properly retrieving the user on second sign in. Instead, it’s treating the user as “Unknown” and saving a new entry in CloudKit and locally. Is there a tutorial aside from 'Juice' that is recent and up to date?
I am currently implementing an authentication function using ASWebAuthenticationSession to log in with my Instagram account.
I set a custom scheme for the callbackURLScheme, but
In the Instagram redirect URL
I was told I can't use a custom scheme.
What should I do with the callbackURLScheme of the ASWebAuthenticationSession in this case?
Apple Sign In - "Sign up not completed" Error in Development Build (React Native / Expo)
Problem Summary
I'm implementing Apple Sign In in a React Native app using expo-apple-authentication. The Apple sign-in dialog appears as expected, but after tapping "Continue," it displays the message: "Sign up not completed". No credential is returned, and the promise eventually rejects with ERR_REQUEST_CANCELED.
App Configuration
Platform: React Native (Expo SDK 52)
Library: expo-apple-authentication v7.1.3
Target: iOS development build (not Expo Go)
Bundle ID: com.example.appname.nativetest (new App ID created for testing)
Apple Developer Console Setup (Reviewed Carefully)
App ID
Explicit App ID (not a wildcard)
"Sign In with Apple" capability enabled
No associated Services IDs or Sign In with Apple Keys
Provisioning Profile
Development profile created for the test App ID
Profile includes the test device and development certificate
Installed successfully and used to sign the app
Certificates and Signing
Valid Apple Developer Program membership
Development certificate installed and selected during build
App installs and launches properly on the test device
Implementation Attempts
Attempt 1: Supabase OAuth Method
Initially tried using Supabase’s built-in Apple OAuth provider:
Configured with team ID, key ID, and JWT credentials
Proper redirect URLs and scheme were in place
Resulted in OAuth URL pointing to Supabase instead of Apple, with incomplete client ID
Ultimately moved to native implementation for improved control and reliability
Attempt 2: Native Apple Sign In (Current Approach)
Using expo-apple-authentication with the following code:
const credential = await AppleAuthentication.signInAsync({
requestedScopes: [
AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
AppleAuthentication.AppleAuthenticationScope.EMAIL,
],
});
Relevant app.config.js Section:
ios: {
bundleIdentifier: 'com.example.appname.nativetest',
usesAppleSignIn: true,
infoPlist: {
NSAppTransportSecurity: {
NSAllowsArbitraryLoads: true,
NSAllowsLocalNetworking: true,
},
},
},
plugins: ['expo-apple-authentication']
Observed Behavior
AppleAuthentication.isAvailableAsync() → true
Credential state → NOT_FOUND (expected for new user)
Apple Sign In dialog appears and allows interaction
User taps "Continue" → dialog reports "Sign up not completed"
Eventually returns: [Error: The user canceled the authorization attempt], code ERR_REQUEST_CANCELED
Confirmed Working Aspects
AppleAuthentication API is available and initialized
App is signed correctly and launches on the physical test device
Apple Sign In dialog appears with correct styling and options
Same result observed across both Wi-Fi and cellular networks
Clean Setup and Debugging Performed
Removed all previous build artifacts
Created a new App ID and new provisioning profile
Rebuilt the app using expo run:ios --device
Validated entitlements and provisioning assignments
Removed any Services IDs and Apple Sign In keys used in previous attempts
Verified ATS (App Transport Security) policies allow dev-time communication
Environment Information
Device: iPhone (not simulator)
iOS Version: 18.5
Xcode: Latest version
Apple ID: Developer account with 2FA enabled
Build Method: EAS CLI using expo run:ios --device
Open Questions
Has anyone experienced the "Sign up not completed" issue with a clean native implementation in Expo?
Are there known limitations when testing Apple Sign In in local development builds?
Could prior Apple ID authorization attempts impact sign-in behavior during testing?
Are there any additional configuration steps, Info.plist changes, or entitlements required beyond those listed above?
Thank you in advance for any suggestions or guidance. We’re hoping this is simply a configuration detail that needs to be adjusted.