---
title: "oneTimeCodes(preferredDuration:anchor:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/asdeliveredverificationcodesmanager/onetimecodes(preferredduration:anchor:)-tyrg"
---

# oneTimeCodes(preferredDuration:anchor:)

Stream one-time codes received by the system.

## Declaration

```swift
func oneTimeCodes(preferredDuration: TimeInterval = 600, anchor: ASPresentationAnchor) async throws -> some AsyncSequence<ASVerificationCode, any Error>

```

## Parameters

- `preferredDuration`: How long the stream should ideally remain connected. This duration is not guaranteed and defaults to 10 minutes.
- `anchor`: The anchor for which any UI should be presented from.

## Discussion

Discussion When requested, the user may decide whether your app may receive one-time codes. This stream will automatically disconnect after a period of time. note: ASDeliveredVerificationCodesManager.VerificationError if one-time codes can not be delivered. note: Only enabled credential providers may call this method.
