Skip to content

Commit

Permalink
fix: render the right auth mode for admin queries in config files (#7118
Browse files Browse the repository at this point in the history
)

fixes #6983: Updated the frontend config files to have the correct authorization type for AdminQueries
  • Loading branch information
yuth committed Apr 29, 2021
1 parent 463e975 commit 8f8deba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ const createAdminAuthAPI = async (context: any, authResourceName: string, functi
const backendConfigs = {
service: 'API Gateway',
providerPlugin: 'awscloudformation',
authorizationType: 'AMAZON_COGNITO_USER_POOLS',
dependsOn,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function constructApi(metadata, amplifyConfig) {
endpointType: 'REST',
endpoint: resourceMeta.output.RootUrl,
region,
authorizationType: 'AWS_IAM',
authorizationType: resourceMeta.authorizationType || 'AWS_IAM',
};
} else if (resourceMeta.service === 'ElasticContainer' && resourceMeta.apiType === 'REST') {
amplifyConfig[categoryName].plugins[pluginName][r] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ function constructApi(metadata, amplifyConfig) {
endpointType: 'REST',
endpoint: resourceMeta.output.RootUrl,
region,
authorizationType: 'AWS_IAM',
authorizationType: resourceMeta.authorizationType || 'AWS_IAM',
};
} else if (resourceMeta.service === 'ElasticContainer' && resourceMeta.apiType === 'REST') {
amplifyConfig[categoryName].plugins[pluginName][r] = {
endpointType: 'REST',
endpoint: resourceMeta.output.RootUrl,
region,
authorizationType: resourceMeta.restrictAccess ? "AMAZON_COGNITO_USER_POOLS" : "AWS_IAM",
authorizationType: resourceMeta.restrictAccess ? 'AMAZON_COGNITO_USER_POOLS' : 'AWS_IAM',
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/amplify-frontend-ios/lib/amplify-config-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ function constructApi(metadata, amplifyConfig) {
endpointType: 'REST',
endpoint: resourceMeta.output.RootUrl,
region,
authorizationType: 'AWS_IAM',
authorizationType: resourceMeta.authorizationType || 'AWS_IAM',
};
} else if (resourceMeta.service === 'ElasticContainer' && resourceMeta.apiType === 'REST') {
amplifyConfig[categoryName].plugins[pluginName][r] = {
endpointType: 'REST',
endpoint: resourceMeta.output.RootUrl,
region,
authorizationType: resourceMeta.restrictAccess ? "AMAZON_COGNITO_USER_POOLS" : "AWS_IAM",
authorizationType: resourceMeta.restrictAccess ? 'AMAZON_COGNITO_USER_POOLS' : 'AWS_IAM',
};
}
}
Expand Down

0 comments on commit 8f8deba

Please sign in to comment.