Skip to content

Commit 213df33

Browse files
committed
Working on OAuth
1 parent 8aee7f0 commit 213df33

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

NotionForCmdPalOAuthAPI/Authentication/OAuthClient.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ public static async Task<IActionResult> HandleOAuthRedirection(Uri response)
6565
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
6666
request.Content.Headers.Add("Notion-Version", "2022-06-28");
6767
request.Headers.Authorization = new AuthenticationHeaderValue("Basic", notionBase64Auth);
68-
68+
var x = "";
6969
using var client = new HttpClient();
7070
try
7171
{
7272
var responseMessage = await client.SendAsync(request);
7373
responseMessage.EnsureSuccessStatusCode();
7474

75+
x = await responseMessage.Content.ReadAsStringAsync();
7576
var responseContent = await responseMessage.Content.ReadFromJsonAsync<OAuthResponse>();
7677

7778
if (!responseContent!.IsSuccess)
@@ -91,17 +92,15 @@ public static async Task<IActionResult> HandleOAuthRedirection(Uri response)
9192
catch (HttpRequestException ex)
9293
{
9394
Debug.WriteLine($"Request failed: {ex.Message}");
94-
return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later. {ex.Message}" };
9595
}
9696
catch (JsonException ex)
9797
{
9898
Debug.WriteLine($"JSON parsing failed: {ex.Message}");
99-
return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later. {ex.Message}" };
99+
return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later. \n\n{x}\n\n{ex.Message}" };
100100
}
101101
catch (Exception ex)
102102
{
103103
Debug.WriteLine($"Unexpected error: {ex.Message}");
104-
return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later. {ex.Message}" };
105104
}
106105

107106
return new ContentResult() { StatusCode = 500, ContentType = "text/plain", Content = $"There was a problem authenticating with Notion. Please try again later." };

0 commit comments

Comments
 (0)