I did not find a way to authenticate for the first time without the user presence.
However TeamViewer supports refresh tokens. So you do not need to prompt the user to login again if the token is refreshed.
The only problem when you use the base class is that it uses sessions to store tokens. So it cannot be used to access the API when the user is not present.
But you can use the database based sub-class like the mysqli one or the new file based sub-class, so the class can retrieve tokens and call the API even when the user is not present.
Check this article to learn how to use tokens offline when the user is not present.
phpclasses.org/blog/package/7700/po ...