we can actually store a token from a username and password login now, could be a good idea to store it more securely than the config file though..
This commit is contained in:
parent
db4165437d
commit
4cf87623e4
9 changed files with 10 additions and 10 deletions
|
@ -254,11 +254,10 @@ namespace JellyfinRPC
|
|||
}
|
||||
|
||||
}
|
||||
private static ConfigForm configForm = new ConfigForm();
|
||||
public static async Task GetTokenFromUsernameAndPassword(string Username, string Password)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", $"MediaBrowser Client=\"JellyfinRPC {AssemblyVersion},\", Device=\"{System.Net.Dns.GetHostName()}\", DeviceId=\"{ConfigManager.GetEntry("DeviceID")}\", Version=\"running on {Environment.OSVersion}\"");
|
||||
httpClient.DefaultRequestHeaders.Add("Authorization", $"MediaBrowser Client=\"JellyfinRPC {AssemblyVersion}, \", Device=\"{System.Net.Dns.GetHostName()}\", DeviceId=\"{ConfigManager.GetEntry("DeviceID")}\", Version=\"running on {Environment.OSVersion}\"");
|
||||
if (ConfigManager.GetEntry("ServerURL") != "")
|
||||
{
|
||||
|
||||
|
@ -278,12 +277,14 @@ namespace JellyfinRPC
|
|||
response.EnsureSuccessStatusCode();
|
||||
|
||||
var jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
|
||||
var jsonShit = JObject.Parse(jsonResponse);
|
||||
|
||||
var getThatToken = JArray.Parse(jsonResponse);
|
||||
|
||||
foreach (var item in getThatToken)
|
||||
string thatToken = jsonShit.Value<string>("AccessToken");
|
||||
|
||||
if (thatToken != null && thatToken != " ")
|
||||
{
|
||||
ConfigManager.SetEntry("JellyfinToken", item["AccessToken"].ToString());
|
||||
ConfigManager.SetEntry("JellyfinToken", thatToken);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue