@@ -93,7 +93,7 @@ public ShopifyService(ILogger logger, ITokenService tokenService)
93
93
}
94
94
#endif
95
95
96
- public EditorSettings GetApiConfiguration ( )
96
+ public async Task < EditorSettings > GetApiConfiguration ( )
97
97
{
98
98
if ( string . IsNullOrEmpty ( _settings . Shop )
99
99
|| string . IsNullOrEmpty ( _settings . ApiVersion ) )
@@ -105,11 +105,12 @@ public EditorSettings GetApiConfiguration()
105
105
106
106
// validate OAuth configuration if AuthorizationService is used.
107
107
// if authorization is managed through UmbracoAuthorizationService, the properties client ID and proxy URL are set correctly.
108
+ var accessTokenValidationResponse = await ValidateAccessToken ( ) ;
108
109
if ( _settings . UseUmbracoAuthorization )
109
110
{
110
111
var editorSettings = new EditorSettings { IsValid = true , Type = ConfigurationType . OAuth } ;
111
112
112
- editorSettings . IsConnected = ValidateAccessToken ( ) . ConfigureAwait ( false ) . GetAwaiter ( ) . GetResult ( ) . IsValid ;
113
+ editorSettings . IsConnected = accessTokenValidationResponse . IsValid ;
113
114
114
115
return editorSettings ;
115
116
}
@@ -120,7 +121,7 @@ public EditorSettings GetApiConfiguration()
120
121
&& ! string . IsNullOrEmpty ( _oauthSettings . RedirectUri )
121
122
? new EditorSettings {
122
123
IsValid = true ,
123
- IsConnected = ValidateAccessToken ( ) . ConfigureAwait ( false ) . GetAwaiter ( ) . GetResult ( ) . IsValid ,
124
+ IsConnected = accessTokenValidationResponse . IsValid ,
124
125
Type = ConfigurationType . OAuth
125
126
}
126
127
: new EditorSettings ( ) ;
@@ -164,7 +165,9 @@ public void RevokeAccessToken()
164
165
public async Task < ResponseDto < ProductsListDto > > GetResults ( string pageInfo )
165
166
{
166
167
string accessToken ;
167
- if ( GetApiConfiguration ( ) . Type . Value == ConfigurationType . OAuth . Value )
168
+
169
+ var apiConfiguration = await GetApiConfiguration ( ) ;
170
+ if ( apiConfiguration . Type . Value == ConfigurationType . OAuth . Value )
168
171
_tokenService . TryGetParameters ( Constants . AccessTokenDbKey , out accessToken ) ;
169
172
else
170
173
{
@@ -222,7 +225,8 @@ public async Task<ResponseDto<ProductsListDto>> GetResults(string pageInfo)
222
225
public async Task < ResponseDto < ProductsListDto > > GetProductsByIds ( long [ ] ids )
223
226
{
224
227
string accessToken ;
225
- if ( GetApiConfiguration ( ) . Type . Value == ConfigurationType . OAuth . Value )
228
+ var apiConfiguration = await GetApiConfiguration ( ) ;
229
+ if ( apiConfiguration . Type . Value == ConfigurationType . OAuth . Value )
226
230
_tokenService . TryGetParameters ( Constants . AccessTokenDbKey , out accessToken ) ;
227
231
else
228
232
{
@@ -272,7 +276,8 @@ public async Task<ResponseDto<ProductsListDto>> GetProductsByIds(long[] ids)
272
276
public async Task < int > GetCount ( )
273
277
{
274
278
string accessToken ;
275
- if ( GetApiConfiguration ( ) . Type . Value == ConfigurationType . OAuth . Value )
279
+ var apiConfiguration = await GetApiConfiguration ( ) ;
280
+ if ( apiConfiguration . Type . Value == ConfigurationType . OAuth . Value )
276
281
_tokenService . TryGetParameters ( Constants . AccessTokenDbKey , out accessToken ) ;
277
282
else
278
283
{
0 commit comments