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