<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AuthenticationServices",
  "identifier" : "/documentation/AuthenticationServices/ASDeliveredVerificationCodesManager/oneTimeCodes(preferredDuration:anchor:)-6x2k6",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Authentication Services"
    ],
    "preciseIdentifier" : "s:22AuthenticationServices35ASDeliveredVerificationCodesManagerC07oneTimeE017preferredDuration6anchorQrSd_So8NSWindowCtYaKF"
  },
  "title" : "oneTimeCodes(preferredDuration:anchor:)"
}
-->

# oneTimeCodes(preferredDuration:anchor:)

Stream one-time codes received by the system.

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

## Parameters

`preferredDuration`

How long the stream should ideally remain connected. This duration is not guaranteed.

`anchor`

The anchor for which any UI should be presented from.

## 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.

> Throws: `ASDeliveredVerificationCodesManager.VerificationError` if one-time codes can not be delivered.

> Note: Only enabled credential providers may call this method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)