---
title: "getCredentialState(forUserID:completion:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/asauthorizationappleidprovider/getcredentialstate(foruserid:completion:)"
---

# getCredentialState(forUserID:completion:)

Returns the credential state for the given user in a completion handler.

## Declaration

```swift
func getCredentialState(forUserID userID: String, completion: @escaping @Sendable (ASAuthorizationAppleIDProvider.CredentialState, (any Error)?) -> Void)
```

```swift
func credentialState(forUserID userID: String) async throws -> ASAuthorizationAppleIDProvider.CredentialState
```

## Parameters

- `userID`: An opaque string associated with the Apple ID that your app receives in the credential’s doc://com.apple.authenticationservices/documentation/AuthenticationServices/ASAuthorizationAppleIDCredential/user property after performing a successful authentication request.
- `completion`: A block the method calls to report the state and an optional error condition.

## See Also

### Getting State

- [ASAuthorizationAppleIDProvider.CredentialState](authenticationservices/asauthorizationappleidprovider/credentialstate.md)
- [credentialRevokedNotification](authenticationservices/asauthorizationappleidprovider/credentialrevokednotification.md)
