Authentication from external Api

I have my Rest Api that use an external DB.
If I want to use this API I need an authenticated user. He use a REST call that generate a Token usable for alla the session.
How can I do it?

Thank you

Drupal version: