How to retrieve an Authentication tokens in a get request?

xirosxvi

Client
Регистрация
24.09.2019
Сообщения
20
Благодарностей
0
Баллы
1
Hello,

I can't get Authorization Bearer.
When I connect to a platform, this platform automatically generates a token for the session.

I would like to get this token to make get requests on the site.

Do you have a solution? It would help me a lot

Best regards
 

Вложения

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113
How do you get token manually from this service in browser?
 

xirosxvi

Client
Регистрация
24.09.2019
Сообщения
20
Благодарностей
0
Баллы
1
I would like to get it and put it in a variable
 

BAZAg

Client
Регистрация
08.11.2015
Сообщения
1 794
Благодарностей
2 466
Баллы
113
Hello,

I can't get Authorization Bearer.
When I connect to a platform, this platform automatically generates a token for the session.

I would like to get this token to make get requests on the site.

Do you have a solution? It would help me a lot

Best regards
You can get headers like this.

C#:
instance.SetUserHeader("Test", "Login_data"); // demo header
instance.UseTrafficMonitoring = true;
string url = "https://nghttp2.org/httpbin/get";
instance.ActiveTab.Navigate(url);
instance.ActiveTab.WaitDownloading();

var items = instance.ActiveTab.GetTraffic();
if(items.Count() > 0) {
    foreach(var item in items){
        if(item != null) {
            if(item.Url.Contains(url)){
                project.SendInfoToLog(Global.ZennoLab.Json.JsonConvert.SerializeObject(item,  Global.ZennoLab.Json.Formatting.None));
               
                return item.RequestHeaders;
            }
        }
    }
}
99380



The same code without notice in the log and unnecessary checks that were used to verify the correctness of the work.
C#:
instance.UseTrafficMonitoring = true;
string url = "https://nghttp2.org/httpbin/get";
instance.ActiveTab.Navigate(url);
instance.ActiveTab.WaitDownloading();

var items = instance.ActiveTab.GetTraffic();
foreach(var item in items){
 if(item.Url.Contains(url))    return item.RequestHeaders;
}
 
Последнее редактирование:

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)