change GET to POST for login flow v2
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Version>3.0.5</Version>
|
||||
<Version>3.0.</Version>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.LoginFlowV2
|
||||
|
||||
public OcsResponseLoginFlowV2? Init(string url)
|
||||
{
|
||||
return Manager.MakeRequest<OcsResponseLoginFlowV2>(HttpMethod.Get, url + OCS_LOGIN_INIT);
|
||||
return Manager.MakeRequest<OcsResponseLoginFlowV2>(HttpMethod.Post, url + OCS_LOGIN_INIT);
|
||||
}
|
||||
|
||||
public OcsResponseLoginFlowV2Credentials? Poll(OcsResponseLoginFlowV2.PollData poll)
|
||||
@@ -26,7 +26,7 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Client.LoginFlowV2
|
||||
ArgumentNullException.ThrowIfNull(poll?.Endpoint);
|
||||
ArgumentNullException.ThrowIfNull(poll?.Token);
|
||||
|
||||
return Manager.MakeRequest<OcsResponseLoginFlowV2Credentials?>(HttpMethod.Get, poll.Endpoint,
|
||||
return Manager.MakeRequest<OcsResponseLoginFlowV2Credentials?>(HttpMethod.Post, poll.Endpoint,
|
||||
parameters: new Dictionary<string, string>
|
||||
{
|
||||
{ "token", poll.Token }
|
||||
|
||||
@@ -119,10 +119,15 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Ocs
|
||||
using var responseInit = MakeRequest(httpMethod, url, useAuthentication: useAuthentication, parameters: parameters, content: content);
|
||||
|
||||
if (responseInit != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var bodyInit = responseInit.Content.ReadAsStringAsync().Result;
|
||||
return JsonConvert.DeserializeObject<TResponse>(bodyInit);
|
||||
}
|
||||
catch(FormatException) { }
|
||||
catch(JsonSerializationException) { }
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
@@ -192,11 +197,15 @@ namespace Pilz.Networking.CloudProviders.Nextcloud.Ocs
|
||||
{
|
||||
{ "Accept", CONTENT_TYPE_JSON },
|
||||
{ "OCS-APIREQUEST", "true" },
|
||||
{ "Authorization", authentication.ToBasicAuth() }
|
||||
//{ "Authorization", authentication.ToBasicAuth() }
|
||||
},
|
||||
Content = httpContent
|
||||
};
|
||||
|
||||
// Add authorization
|
||||
if (authentication != null)
|
||||
request.Headers.Add("Authorization", authentication.ToBasicAuth());
|
||||
|
||||
return client.Send(request);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Version>2.1.0</Version>
|
||||
<Version>2.1.1</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user