@@ -91,14 +91,21 @@ public class AWSGraphQLSubscriptionTaskRunner<R: Decodable>: InternalTaskRunner,
91
91
return
92
92
}
93
93
94
- let pluginOptions = request. options. pluginOptions as? AWSAPIPluginDataStoreOptions
94
+ let authType : AWSAuthorizationType ?
95
+ if let pluginOptions = request. options. pluginOptions as? AWSAPIPluginDataStoreOptions {
96
+ authType = pluginOptions. authType
97
+ } else if let authorizationMode = request. authMode as? AWSAuthorizationType {
98
+ authType = authorizationMode
99
+ } else {
100
+ authType = nil
101
+ }
95
102
// Retrieve the subscription connection
96
103
do {
97
104
self . appSyncClient = try await appSyncClientFactory. getAppSyncRealTimeClient (
98
105
for: endpointConfig,
99
106
endpoint: endpointConfig. baseURL,
100
107
authService: authService,
101
- authType: pluginOptions ? . authType,
108
+ authType: authType,
102
109
apiAuthProviderFactory: apiAuthProviderFactory
103
110
)
104
111
@@ -262,14 +269,21 @@ final public class AWSGraphQLSubscriptionOperation<R: Decodable>: GraphQLSubscri
262
269
return
263
270
}
264
271
265
- let pluginOptions = request. options. pluginOptions as? AWSAPIPluginDataStoreOptions
272
+ let authType : AWSAuthorizationType ?
273
+ if let pluginOptions = request. options. pluginOptions as? AWSAPIPluginDataStoreOptions {
274
+ authType = pluginOptions. authType
275
+ } else if let authorizationMode = request. authMode as? AWSAuthorizationType {
276
+ authType = authorizationMode
277
+ } else {
278
+ authType = nil
279
+ }
266
280
Task {
267
281
do {
268
282
appSyncRealTimeClient = try await appSyncRealTimeClientFactory. getAppSyncRealTimeClient (
269
283
for: endpointConfig,
270
284
endpoint: endpointConfig. baseURL,
271
285
authService: authService,
272
- authType: pluginOptions ? . authType,
286
+ authType: authType,
273
287
apiAuthProviderFactory: apiAuthProviderFactory
274
288
)
275
289
0 commit comments