File tree Expand file tree Collapse file tree 4 files changed +22
-8
lines changed
src/Umbraco.Cms.Integrations.Commerce.Shopify
App_Plugins/UmbracoCms.Integrations/Commerce/Shopify/js Expand file tree Collapse file tree 4 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 62
62
63
63
function validateOAuthSetup ( ) {
64
64
umbracoCmsIntegrationsCommerceShopifyResource . validateAccessToken ( ) . then ( function ( response ) {
65
-
66
65
vm . oauthSetup = {
67
- isConnected : response . isValid ,
66
+ isValid : response . isValid ,
67
+ isConnected : response . isConnected ,
68
68
isAccessTokenExpired : response . isExpired ,
69
- isAccessTokenValid : response . isValid
69
+ isAccessTokenValid : response . isConnected
70
70
}
71
71
72
72
if ( vm . oauthSetup . isConnected === true && vm . oauthSetup . isAccessTokenValid === true ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,9 @@ public EditorSettings()
12
12
[ JsonProperty ( "isValid" ) ]
13
13
public bool IsValid { get ; set ; }
14
14
15
+ [ JsonProperty ( "isConnected" ) ]
16
+ public bool IsConnected { get ; set ; }
17
+
15
18
[ JsonProperty ( "type" ) ]
16
19
public ConfigurationType Type { get ; set ; }
17
20
}
Original file line number Diff line number Diff line change @@ -16,8 +16,7 @@ public class BaseAuthorizationService
16
16
protected const string ShopifyAuthorizationUrl = "https://{0}.myshopify.com/admin/oauth/authorize" +
17
17
"?client_id={1}" +
18
18
"&redirect_uri={2}" +
19
- "&scope=read_products" +
20
- "&grant_options[]=value" ;
19
+ "&scope=read_products" ;
21
20
22
21
public BaseAuthorizationService ( ITokenService tokenService )
23
22
{
Original file line number Diff line number Diff line change @@ -106,13 +106,25 @@ public EditorSettings GetApiConfiguration()
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
108
if ( _settings . UseUmbracoAuthorization )
109
- return new EditorSettings { IsValid = true , Type = ConfigurationType . OAuth } ;
109
+ {
110
+ var editorSettings = new EditorSettings { IsValid = true , Type = ConfigurationType . OAuth } ;
111
+
112
+ editorSettings . IsConnected = ValidateAccessToken ( ) . ConfigureAwait ( false ) . GetAwaiter ( ) . GetResult ( ) . IsValid ;
113
+
114
+ return editorSettings ;
115
+ }
110
116
else
117
+ {
111
118
return ! string . IsNullOrEmpty ( _oauthSettings . ClientId )
112
119
&& ! string . IsNullOrEmpty ( _oauthSettings . ClientSecret )
113
120
&& ! string . IsNullOrEmpty ( _oauthSettings . RedirectUri )
114
- ? new EditorSettings { IsValid = true , Type = ConfigurationType . OAuth }
121
+ ? new EditorSettings {
122
+ IsValid = true ,
123
+ IsConnected = ValidateAccessToken ( ) . ConfigureAwait ( false ) . GetAwaiter ( ) . GetResult ( ) . IsValid ,
124
+ Type = ConfigurationType . OAuth
125
+ }
115
126
: new EditorSettings ( ) ;
127
+ }
116
128
}
117
129
118
130
public async Task < ResponseDto < ProductsListDto > > ValidateAccessToken ( )
@@ -146,7 +158,7 @@ public async Task<ResponseDto<ProductsListDto>> ValidateAccessToken()
146
158
147
159
public void RevokeAccessToken ( )
148
160
{
149
- _tokenService . RemoveParameters ( Constants . Configuration . UmbracoCmsIntegrationsCommerceShopifyAccessToken ) ;
161
+ _tokenService . RemoveParameters ( Constants . AccessTokenDbKey ) ;
150
162
}
151
163
152
164
public async Task < ResponseDto < ProductsListDto > > GetResults ( string pageInfo )
You can’t perform that action at this time.
0 commit comments