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

# retrieveAllCredentials(_:)

Requests all Thread credentials from the framework.

## Declaration

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

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

## Parameters

- `completion`: The completion handler the framework calls when the 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 allCredentials() async throws -> Set<THCredentials> For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. The framework identifies the developer by the team ID. When calling this method, you receive credentials for your team ID only. Call the method as follows: func obtainAllCredentials() async -> (Set<THCredentials>?, Error?) {     let client = THClient()     var credentials: Set<THCredentials>?     var err:Error?     do {         credentials = try await client.allCredentials()     } 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)
- [retrievePreferredCredentials(_:)](threadnetwork/thclient/retrievepreferredcredentials(_:).md)
- [retrieveAllActiveCredentials(_:)](threadnetwork/thclient/retrieveallactivecredentials(_:).md)
