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

# oneTimeCodes(preferredDuration:)

Stream one-time codes received by the system.

## Declaration

```swift
@MainActor func oneTimeCodes(preferredDuration: TimeInterval = 600) 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.

## 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: DeliveredVerificationCodesManager.VerificationError if one-time codes can not be delivered. note: Only enabled credential providers may call this method.
