Skip to content

Commit 2b2856a

Browse files
sebalandlawmicha
andauthored
fix(Auth): Fixing the Gen2 json configuration used by the Authenticator (#3647)
--------- Co-authored-by: Michael Law <[email protected]>
1 parent 162847a commit 2b2856a

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Helpers/ConfigurationHelper.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ struct ConfigurationHelper {
220220
AuthPluginErrorConstants.configurationMissingError
221221
)
222222
}
223-
let userPoolConfig = try parseUserPoolData(config)
223+
let userPoolConfig = parseUserPoolData(config)
224224
let identityPoolConfig = parseIdentityPoolData(config)
225225

226226
return try createAuthConfiguration(userPoolConfig: userPoolConfig,
@@ -281,11 +281,10 @@ struct ConfigurationHelper {
281281
"verificationMechanism": .array(verificationMechanisms)])
282282
}
283283

284-
return JSONValue.object(
285-
["auth": .object(
286-
["plugins": .object(
287-
["awsCognitoAuthPlugin": .object(
288-
["Auth": .object(
289-
["Default": authConfigObject])])])])])
284+
return JSONValue.object([
285+
"Auth": .object([
286+
"Default": authConfigObject
287+
])
288+
])
290289
}
291290
}

AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/Support/ConfigurationHelperTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ final class ConfigurationHelperTests: XCTestCase {
246246
]))
247247
let json = ConfigurationHelper.createUserPoolJsonConfiguration(config)
248248

249-
guard let authConfig = json.auth?.plugins?.awsCognitoAuthPlugin?.Auth?.Default else {
249+
guard let authConfig = json.Auth?.Default else {
250250
XCTFail("Could not retrieve auth configuration from json")
251251
return
252252
}

0 commit comments

Comments
 (0)