---
title: "remove(_:for:options:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlcredentialstorage/remove(_:for:options:)"
---

# remove(_:for:options:)

Removes the specified credential from the credential storage for the specified protection space using the given options.

## Declaration

```swift
func remove(_ credential: URLCredential, for space: URLProtectionSpace, options: [String : Any]? = nil)
```

## Parameters

- `credential`: The credential to remove.
- `space`: The protection space from which to remove the credential.
- `options`: A dictionary containing options to consider when removing the credential. For possible keys, see doc://com.apple.foundation/documentation/Foundation/dictionary-key-for-credential-removal-options. You should use this when trying to delete a credential that has the doc://com.apple.foundation/documentation/Foundation/URLCredential/Persistence-swift.enum/synchronizable policy. note: When credential objects that have a doc://com.apple.foundation/documentation/Foundation/URLCredential/Persistence-swift.enum/synchronizable policy are removed, the credential will be removed on all devices that contain this credential.

## Discussion

Discussion The credential is removed from both persistent and temporary storage. If you override this method, also override remove(_:for:options:task:).

## See Also

### Adding and removing credentials

- [remove(_:for:)](foundation/urlcredentialstorage/remove(_:for:).md)
- [remove(_:for:options:task:)](foundation/urlcredentialstorage/remove(_:for:options:task:).md)
- [Dictionary key for credential removal options](foundation/dictionary-key-for-credential-removal-options.md)
- [set(_:for:)](foundation/urlcredentialstorage/set(_:for:).md)
- [set(_:for:task:)](foundation/urlcredentialstorage/set(_:for:task:).md)
