---
title: "retrieveAllActiveCredentials(_:)"
framework: threadnetwork
role: symbol
role_heading: Instance Method
path: "threadnetwork/thclient/retrieveallactivecredentials(_:)"
---

# retrieveAllActiveCredentials(_:)

Returns a set of the active credentials.

## Declaration

```swift
func retrieveAllActiveCredentials(_ completion: @escaping @Sendable (Set<THCredentials>?, (any Error)?) -> Void)
```

```swift
func allActiveCredentials() async throws -> Set<THCredentials>
```

## Parameters

- `completion`: The completion handler the framework calls when the active credentials become available.

## Mentioned in

Managing Thread network credentials

## Discussion

Discussion note: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func allActiveCredentials() async throws -> Set<THCredentials> For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. Call the method as follows: func obtainAllActiveCredentials() async -> (Set<THCredentials>?, Error?) {     let client = THClient()     var credentials: Set<THCredentials>?     var err:Error?     do {         credentials = try await client.allActiveCredentials()     } catch {         err = error     }     return (credentials, err) }

## See Also

### Retrieving Credentials

- [isPreferredNetworkAvailable(completion:)](threadnetwork/thclient/ispreferrednetworkavailable(completion:).md)
- [checkPreferredNetwork(forActiveOperationalDataset:completion:)](threadnetwork/thclient/checkpreferrednetwork(foractiveoperationaldataset:completion:).md)
- [retrieveCredentials(forBorderAgent:completion:)](threadnetwork/thclient/retrievecredentials(forborderagent:completion:).md)
- [retrieveCredentials(forExtendedPANID:completion:)](threadnetwork/thclient/retrievecredentials(forextendedpanid:completion:).md)
- [retrieveAllCredentials(_:)](threadnetwork/thclient/retrieveallcredentials(_:).md)
- [retrievePreferredCredentials(_:)](threadnetwork/thclient/retrievepreferredcredentials(_:).md)
