diff --git a/Amplify/Core/Configuration/AmplifyOutputsData.swift b/Amplify/Core/Configuration/AmplifyOutputsData.swift index 5fb9435c2f..bdd7270017 100644 --- a/Amplify/Core/Configuration/AmplifyOutputsData.swift +++ b/Amplify/Core/Configuration/AmplifyOutputsData.swift @@ -66,8 +66,7 @@ public struct AmplifyOutputsData: Codable { @_spi(InternalAmplifyConfiguration) public struct OAuth: Codable { public let identityProviders: [String] - public let cognitoDomain: String - public let customDomain: String? + public let domain: String public let scopes: [String] public let redirectSignInUri: [String] public let redirectSignOutUri: [String] diff --git a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Helpers/ConfigurationHelper.swift b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Helpers/ConfigurationHelper.swift index 877571243c..ae6d367070 100644 --- a/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Helpers/ConfigurationHelper.swift +++ b/AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Helpers/ConfigurationHelper.swift @@ -159,7 +159,7 @@ struct ConfigurationHelper { return createHostedConfiguration(appClientId: configuration.userPoolClientId, clientSecret: nil, - domain: oauth.customDomain ?? oauth.cognitoDomain, + domain: oauth.domain, scopes: oauth.scopes, signInRedirectURI: signInRedirectURI, signOutRedirectURI: signOutRedirectURI) diff --git a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/Support/ConfigurationHelperTests.swift b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/Support/ConfigurationHelperTests.swift index d2f5f732ff..ee6ea93a1e 100644 --- a/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/Support/ConfigurationHelperTests.swift +++ b/AmplifyPlugins/Auth/Tests/AWSCognitoAuthPluginUnitTests/Support/ConfigurationHelperTests.swift @@ -46,8 +46,7 @@ final class ConfigurationHelperTests: XCTestCase { userPoolId: "poolId", userPoolClientId: "clientId", oauth: AmplifyOutputsData.Auth.OAuth(identityProviders: ["provider1", "provider2"], - cognitoDomain: "cognitoDomain", - customDomain: nil, + domain: "domain", scopes: ["scope1", "scope2"], redirectSignInUri: ["redirect1", "redirect2"], redirectSignOutUri: ["signOut1", "signOut2"], @@ -62,35 +61,7 @@ final class ConfigurationHelperTests: XCTestCase { XCTAssertEqual(hostedUIConfig.clientId, "clientId") XCTAssertNil(hostedUIConfig.clientSecret, "Client secret should be nil as its not supported in Gen2") XCTAssertEqual(hostedUIConfig.oauth.scopes, ["scope1", "scope2"]) - XCTAssertEqual(hostedUIConfig.oauth.domain, "cognitoDomain") - XCTAssertEqual(hostedUIConfig.oauth.signInRedirectURI, "redirect1") - XCTAssertEqual(hostedUIConfig.oauth.signOutRedirectURI, "signOut1") - } - - /// Test Oauth section's `customDomain` overwrites `cognitoDomain` - func testParseUserPoolData_WithOAuth_CustomDomain() throws { - let config = AmplifyOutputsData.Auth( - awsRegion: "us-east-1", - userPoolId: "poolId", - userPoolClientId: "clientId", - oauth: AmplifyOutputsData.Auth.OAuth(identityProviders: ["provider1", "provider2"], - cognitoDomain: "cognitoDomain", - customDomain: "customDomain", - scopes: ["scope1", "scope2"], - redirectSignInUri: ["redirect1", "redirect2"], - redirectSignOutUri: ["signOut1", "signOut2"], - responseType: "responseType")) - - guard let config = ConfigurationHelper.parseUserPoolData(config), - let hostedUIConfig = config.hostedUIConfig else { - XCTFail("Expected to parse UserPoolData into object") - return - } - - XCTAssertEqual(hostedUIConfig.clientId, "clientId") - XCTAssertNil(hostedUIConfig.clientSecret) - XCTAssertEqual(hostedUIConfig.oauth.scopes, ["scope1", "scope2"]) - XCTAssertEqual(hostedUIConfig.oauth.domain, "customDomain") + XCTAssertEqual(hostedUIConfig.oauth.domain, "domain") XCTAssertEqual(hostedUIConfig.oauth.signInRedirectURI, "redirect1") XCTAssertEqual(hostedUIConfig.oauth.signOutRedirectURI, "signOut1") }