<!--
{
  "documentType" : "article",
  "framework" : "Security",
  "identifier" : "/documentation/Security/shared-web-credentials",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Shared Web Credentials"
}
-->

# Shared Web Credentials

Share credentials between iOS apps and their website counterparts.

## Discussion

The `Security.SecSharedCredentials` API provides functions for storing and requesting shared password-based credentials. Users often save their username and password in their iCloud keychain when logging into websites in Safari. Later, they may run a native app from the same developer to access the same account. With shared web credentials, the app can access the credentials stored for the website instead of requiring the user to reenter a username and password. Users can also create new accounts, update passwords, or delete their accounts from within the app. These changes are then saved and used by Safari.

![Diagram showing a connection between your app and Safari through iCloud keychain.](images/com.apple.security/media-2891900@2x.png)

> Note:
> Accessing shared web credentials requires permission from the app, the website, and the user.

## Topics

### First Steps

  <doc://com.apple.documentation/documentation/Xcode/supporting-associated-domains>

[Managing Shared Credentials](/documentation/Security/managing-shared-credentials)

Use shared web credentials to create a seamless experience for the user.

### Password Sharing

[`SecAddSharedWebCredential(_:_:_:_:)`](/documentation/Security/SecAddSharedWebCredential(_:_:_:_:))

Asynchronously stores (or updates) a shared password for a website.

[`SecRequestSharedWebCredential(_:_:_:)`](/documentation/Security/SecRequestSharedWebCredential(_:_:_:))

Asynchronously obtains one or more shared passwords for a website.

[`SecCreateSharedWebCredentialPassword()`](/documentation/Security/SecCreateSharedWebCredentialPassword())

Returns a randomly generated password.

[`kSecSharedPassword`](/documentation/Security/kSecSharedPassword)

A dictionary key whose value is the shared password.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)