---
title: "importCredentials(token:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/ascredentialimportmanager/importcredentials(token:)"
---

# importCredentials(token:)

Begins the credential import process.

## Declaration

```swift
func importCredentials(token: UUID) async throws -> ASExportedCredentialData
```

## Parameters

- `token`: The UUID token that the system provided in the doc://com.apple.documentation/documentation/Foundation/NSUserActivity when launching the app.

## Return Value

Return Value The credential data exported from the source app.

## Discussion

Discussion When a person chooses your app to receive credentials exported from another app, the system launches your app using an NSUserActivity of type ASCredentialExchangeActivityType. Handle this in your app delegate for AppKit/UIKit or the onContinueUserActivity(_:perform:) modifier for SwiftUI. The NSUserActivity you receive contains a single UUID object in its userInfo field with the key ASCredentialImportToken; pass this UUID as the token parameter to this method. This method throws an error if the import can’t proceed, which happens if the token doesn’t match what the system expects, indicating an app other than the one the export was meant for.

## See Also

### Importing credentials

- [ASExportedCredentialData](authenticationservices/asexportedcredentialdata.md)
