Skip to main content
🚀 See how 20+ AI Agents can make your QA faster and smarter. Join 10k+ QAs at global leadership summit! Register Now
No Result Found
Connect & Get help from fellow developers on our Discord community. Ask the CommunityAsk the Community

Test certificate based authentication

Test authentication using BrowserStack App Automate.

Test certificate-based authentication using multiple certificate formats (.pfx, .cer, .mobileconfig) on BrowserStack devices. You can automate certificate installation and sign in to dependent apps without manually entering passwords, streamlining your authentication testing workflow.

The certificate upload feature (supports .pfx, .cer, .mobileconfig) is currently in beta. To enable this feature for your account, contact BrowserStack support.

Supported file types and OS version

You can upload certificate files in the following formats:

  • .pfx (Personal Information Exchange)
  • .cer (Certificate)
  • .mobileconfig (Mobile Configuration Profile)

Maximum file size: 10 MB per certificate file.

The following table shows the supported OS and devices to which you can upload your files for testing:

OS OS version
iOS v15 and above
Android v7 and above

BrowserStack supports certificate upload (.pfx, .cer, .mobileconfig) on Android devices with certain exceptions. For more information, contact us.

Upload your file to BrowserStack

Run the following upload media cURL command to upload your file to BrowserStack servers:

Request
Copy icon Copy

Here is a sample cURL response. It returns the media_url parameter value.

Response
Copy icon Copy

BrowserStack creates a Custom_Files folder in Files app → On My iPhone → Your app's directory. You can find the file under the App directory on your device.

Set the capability in test script

To use certificate based authentication, set the customCertificates capability. Here is an example to set this capability in your config file:

Copy icon Copy
Copy icon Copy

Set the browserstack.uploadMedia capability to the value of the media_url parameter returned in the API response as shown in the following code snippets:

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.uploadMedia", new String[]{"media://90c7a8h8dc82308108734e9a46c24d8f01de12881"});
var capabilities = {
	'browserstack.uploadMedia': ['media://90c7a8h8dc82308108734e9a46c24d8f01de12881']
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browserstack.uploadMedia", new[] {"media://90c7a8h8dc82308108734e9a46c24d8f01de12881"});
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("browserstack.uploadMedia", ["media://90c7a8h8dc82308108734e9a46c24d8f01de12881"]);
desired_cap = {
	'browserstack.uploadMedia': ['media://90c7a8h8dc82308108734e9a46c24d8f01de12881']
}
desired_caps = {
    'browserstack.uploadMedia': ['media://90c7a8h8dc82308108734e9a46c24d8f01de12881']
}
  • You can upload and use up to 15 certificates in a session for authentication using the browserstack.customCertificates capability.
  • Each additional certificate installation will increase the session start time.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle