skm
skm

Reputation: 5649

OAuth 2.0 authorization for TeamViewer in C# and its getting sessions list

I want to receive a list of open sessions in Team Viewer via a C# program. I read the Team Viewer API documentation.

As per the documentation, OAuth 2.0 authentication is used to get an access token. But I am not able to understand, how do I pass credential information to it. Just for testing, I also tried to create an access token using Postman Rest API but I am not able to do that as well.

string Version = "v1";
string tvApiUrl = "https://webapi.teamviewer.com/";
string address = tvApiUrl + "/api/" + Version + "/sessions";
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;

//SOMEHOW I HAVE TO ASSIGN CREDENTIAL/AUTHENTICATION TO REQUEST HERE

request.Method = "GET";
WebResponse response = request.GetResponse();
Console.WriteLine(response);

Upvotes: 0

Views: 409

Answers (1)

Ozan
Ozan

Reputation: 4415

You need to get an authorization code first (3.8.1), and then, using that code, request an access token (3.8.2).

You will then use the access token in the authorization header in all the other requests.

Upvotes: 0

Related Questions