Skip to content

Commit 810ebe3

Browse files
committed
correct sheets service configuration on missing google credentials
1 parent aa30dc9 commit 810ebe3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

HwProj.APIGateway/HwProj.APIGateway.API/Startup.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using IStudentsInfo;
2020
using StudentsInfo;
2121
using Newtonsoft.Json.Linq;
22+
using System;
2223

2324
namespace HwProj.APIGateway.API
2425
{
@@ -94,7 +95,14 @@ private static JToken Serialize(IConfigurationSection configurationSection)
9495
private static SheetsService ConfigureGoogleSheets(IConfigurationSection _sheetsConfiguration)
9596
{
9697
var jsonObject = Serialize(_sheetsConfiguration);
97-
var credential = GoogleCredential.FromJson(jsonObject.ToString()).CreateScoped(SheetsService.Scope.Spreadsheets);
98+
GoogleCredential? credential = null;
99+
100+
try
101+
{
102+
credential = GoogleCredential.FromJson(jsonObject.ToString())
103+
.CreateScoped(SheetsService.Scope.Spreadsheets);
104+
}
105+
catch (Exception) {}
98106

99107
return new SheetsService(new BaseClientService.Initializer
100108
{

0 commit comments

Comments
 (0)