Delete user account
Invoke the deleteUser
API to delete a user from the Auth category. This action will also sign your user out.
If your application uses a Cognito User Pool, which is the default configuration for the Amazon Cognito plugin, this action will delete the user from the Cognito User Pool. It will have no effect if you are federating with a Cognito Identity Pool alone.
func deleteUser() { Amplify.Auth.deleteUser() { result in switch result { case .success: print("Successfully deleted user") case .failure(let error): print("Delete user failed with error \(error)") } }}
func deleteUser() -> AnyCancellable { Amplify.Auth.deleteUser() .resultPublisher .sink { if case let .failure(authError) = $0 { print("Delete user failed with error \(authError)") } } receiveValue: { print("Successfully deleted user") }}