---
title: "retrieveActiveCredentialsForNearbyNetworks(completion:)"
framework: ThreadNetwork
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 13.0+, visionOS 27.0+, watchOS 27.0+]
path: "threadnetwork/thclient/retrieveactivecredentialsfornearbynetworks(completion:)"
---

# retrieveActiveCredentialsForNearbyNetworks(completion:)

Requests all active Thread credentials with active border routers around from the framework.

## Declaration

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

```swift
var activeCredentialsForNearbyNetworks: Set<THCredentials> { get async throws }
```

## Parameters

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

## Discussion

Discussion When calling this method, you will receive credentials for active border routers around. You receive all credentials agnostic to team ID. Unlike retrieveAllActiveCredentials(_:), this method returns active credentials on the device regardless of who actually stored it. note: This method asks for user permission to share available credentials. If user denies the permission then the completion will contain error with code 15. 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: var activeCredentialsForNearbyNetworks: Set<THCredentials> { get async throws } For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.
