PHP Classes

Auto-login TeamViewer

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How to Implement a PH...  >  All threads  >  Auto-login TeamViewer  >  (Un) Subscribe thread alerts  
Subject:Auto-login TeamViewer
Summary:Auto-login TeamViewer
Messages:4
Author:Christian
Date:2015-10-23 09:39:18
 

  1. Auto-login TeamViewer   Reply   Report abuse  
Picture of Christian Christian - 2015-10-23 09:39:18
Hi,
thank you for your great code.
I want integrate Teamviewer in my PHP interface and your code works perfectly, but i have only a problem; when i use my interface the first time i must do the login in TeamViewer web page.
Can i do the login automatically with php code without open the web page of TeamViewer?

Thank for your support,
Christian

  2. Auto-login TeamViewer   Reply   Report abuse  
Picture of Christian Christian - 2015-10-23 09:49:15 - In reply to message 1 from Christian
I tested your code using oauth_username and oauth_password but i have an error:

oauth_client_class Object
(
[error] =>
[debug] => 1
[debug_http] => 1
[exit] =>
[debug_output] => OAuth client: Checking if OAuth access token was already retrieved from https://webapi.teamviewer.com/api/v1/oauth2/token
OAuth client: A valid access token is not available
OAuth client: Getting the access token using the username and password
OAuth client: Accessing the OAuth access token at https://webapi.teamviewer.com/api/v1/oauth2/token
OAuth client: Could not retrieve the OAuth access token. Error: it was not possible to access the OAuth access token: it was returned an unexpected response status 400 Response: {"error":"invalid_request","error_description":"client_id parameter missing","error_code":1}

[debug_prefix] => OAuth client:
[server] => TeamViewer
[configuration_file] => oauth_configuration.json
[request_token_url] =>
[dialog_url] => https://webapi.teamviewer.com/api/v1/oauth2/authorize?client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&response_type=code&state={STATE}&api_key={API_KEY}&scope={SCOPE}
[offline_dialog_url] =>
[append_state_to_redirect_uri] =>
[access_token_url] => https://webapi.teamviewer.com/api/v1/oauth2/token
[oauth_version] => 2.0
[url_parameters] =>
[authorization_header] => 1
[token_request_method] => GET
[signature_method] => HMAC-SHA1
[redirect_uri] => http://localhost/xxxx/teamviewer/test_1.php
[client_id] => xxxxx-xxxxxxxxxxxxxxxxxx
[client_secret] => xxxxxxxxxxxxxxxxxxxx
[api_key] =>
[get_token_with_api_key] =>
[scope] =>
[offline] =>
[access_token] =>
[access_token_secret] =>
[access_token_expiry] =>
[access_token_type] =>
[default_access_token_type] =>
[access_token_parameter] =>
[access_token_response] =>
[store_access_token_response] =>
[access_token_authentication] =>
[refresh_token] =>
[access_token_error] => it was not possible to access the OAuth access token: it was returned an unexpected response status 400 Response: {"error":"invalid_request","error_description":"client_id parameter missing","error_code":1}
[authorization_error] => it was not possible to access the OAuth access token: it was returned an unexpected response status 400 Response: {"error":"invalid_request","error_description":"client_id parameter missing","error_code":1}
[response_status] => 400
[oauth_username] => xxxxxxxxxxxxxxxxx
[oauth_password] => xxxxxxxxxxxxxxxxx
[grant_type] => authorization_code
[oauth_user_agent] =>
)

  3. Re: Auto-login TeamViewer   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2015-10-23 17:37:27 - In reply to message 1 from Christian
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 ...

  4. Re: Auto-login TeamViewer   Reply   Report abuse  
Picture of Christian Christian - 2015-10-26 08:34:51 - In reply to message 3 from Manuel Lemos
Ok ok, i understand.

Thank you for your support,
Christian