Open IGNATOV93 opened 9 months ago
Hey, I will check this problem asp
hi, is it also not possible to do authorization? Maybe there are some thoughts?
When requesting a token, it is simply not in the response.Has the authorization address changed? or have you closed a loophole for third-party authorization?
Hey, it's still working. They use sessions, where the cookie contains the token. Just pass the cookie itself, remember “success 1” mean you're authenticated. :)
as a result, the token is not issued anyway ,However, I write in c# static public async Task L(string email, string password) { var url = "https://dash.sonicbit.net/login"; var httpClient = new HttpClient(); var htmlContent = await httpClient.GetStringAsync(url);
var htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(htmlContent);
var csrfTokenNode = htmlDocument.DocumentNode.SelectSingleNode("//meta[@name='csrf-token']");
if (csrfTokenNode == null)
{
Console.WriteLine("CSRF token not found");
return;
}
var csrfToken = csrfTokenNode.GetAttributeValue("content", string.Empty);
Console.WriteLine(csrfToken);
var headers = new Dictionary<string, string>
{ {"User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.37"} };
var loginData = new Dictionary<string, string>
{ {"_token", csrfToken}, {"_method", "POST"}, {"email", email}, {"password", password}, };
var loginEndpoint = "https://dash.sonicbit.net/login_user";
var initialResponse = await httpClient.GetAsync(url);
if (!initialResponse.Headers.Contains("Set-Cookie"))
{
Console.WriteLine("No cookies found in the response");
return;
}
var cookieContainer = new CookieContainer();
using (var handler = new HttpClientHandler() { CookieContainer = cookieContainer })
using (var client = new HttpClient(handler) { BaseAddress = new Uri(url) })
{
foreach (var cookie in initialResponse.Headers.GetValues("Set-Cookie"))
{
cookieContainer.SetCookies(new Uri(url), cookie);
}
client.DefaultRequestHeaders.Clear();
foreach (var header in headers)
{
client.DefaultRequestHeaders.Add(header.Key, header.Value);
}
var response = await client.PostAsync(loginEndpoint, new FormUrlEncodedContent(loginData));
var responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseContent);
var cookies = cookieContainer.GetCookies(new Uri(url));
foreach (Cookie cookie in cookies)
{
Console.WriteLine($"{cookie.Name}: {cookie.Value}");
}
}
}
Really Weird Issue
When requesting a token, it is simply not in the response.Has the authorization address changed? or have you closed a loophole for third-party authorization?