Match existing account to CiviCRM contact
What is the best way to link a Civi Contact to a Drupal account programmatically? I have a D8 module and am using the Civi API (v3) to return the Civi Contact ID based on the Drupal account email, and I now want to link the two. I can just do a database insert into the uf_match table, but thought there might be a built in function?