Skip to content

Commit

Permalink
fix: render the right auth mode for admin queries in config files
Browse files Browse the repository at this point in the history
Updated the frontend config files to have the correct authorization type for AdminQueries

fix aws-amplify#6983
  • Loading branch information
yuth committed Apr 16, 2021
1 parent a46f2a3 commit 5a77481
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 5a77481

Please sign in to comment.