Skip to content

Commit 21d4f80

Browse files
committed
fix: token issue
1 parent 7d7e2f2 commit 21d4f80

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### Version: 2.22.2
2+
#### Date: July-14-2025
3+
4+
##### Fix:
5+
- Fixed token issue for Live Preview
6+
17
### Version: 2.22.1
28
#### Date: June-13-2025
39

Contentstack.Core/Models/Query.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,11 +1886,11 @@ private async Task<JObject> Exec()
18861886
if (this.ContentTypeInstance!=null && this.ContentTypeInstance?.StackInstance.LivePreviewConfig.Enable == true
18871887
&& this.ContentTypeInstance?.StackInstance.LivePreviewConfig.ContentTypeUID == this.ContentTypeInstance?.ContentTypeId
18881888
&& header.Key == "access_token"
1889-
&& isLivePreview)
1889+
&& !string.IsNullOrEmpty(this.ContentTypeInstance.StackInstance.LivePreviewConfig.LivePreview))
18901890
{
18911891
continue;
18921892
}
1893-
headerAll.Add(header.Key, (string)header.Value);
1893+
headerAll.Add(header.Key, (String)header.Value);
18941894
}
18951895
}
18961896

@@ -1941,7 +1941,25 @@ private async Task<JObject> Exec()
19411941
}
19421942
else
19431943
{
1944+
// console.WriteLine url, mainjson and headerAll
1945+
Console.WriteLine("==========================");
1946+
Console.WriteLine(this._Url);
1947+
1948+
foreach (var kvp in mainJson)
1949+
{
1950+
if (kvp.Key == "live_preview")
1951+
{
1952+
Console.WriteLine("mainjson==================");
1953+
Console.WriteLine($"Key: {kvp.Key}, Value: {kvp.Value}");
1954+
}
1955+
}
1956+
Console.WriteLine("headerAll==================");
1957+
foreach (var kvp in headerAll)
1958+
{
1959+
Console.WriteLine($"Key: {kvp.Key}, Value: {kvp.Value}");
1960+
}
19441961
HttpRequestHandler requestHandler = new HttpRequestHandler(this.ContentTypeInstance.StackInstance);
1962+
Console.WriteLine(_Url);
19451963
var outputResult = await requestHandler.ProcessRequest(_Url, headerAll, mainJson, Branch: this.ContentTypeInstance.StackInstance.Config.Branch, isLivePreview: isLivePreview, timeout: this.ContentTypeInstance.StackInstance.Config.Timeout);
19461964
return JObject.Parse(ContentstackConvert.ToString(outputResult, "{}"));
19471965
}

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>2.22.1</Version>
3+
<Version>2.22.2</Version>
44
</PropertyGroup>
55
</Project>

0 commit comments

Comments
 (0)