@aws-amplify/amplify-category-auth
Version:
amplify-cli authentication plugin
27 lines • 1.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAppClientSecret = void 0;
const amplify_cli_core_1 = require("@aws-amplify/amplify-cli-core");
const getAppClientSecret = async (context, userpoolId, clientId) => {
var _a;
try {
const identity = await getCognitoIdentityProviderClient(context);
const params = {
ClientId: clientId,
UserPoolId: userpoolId,
};
const result = await identity.describeUserPoolClient(params).promise();
return (_a = result.UserPoolClient) === null || _a === void 0 ? void 0 : _a.ClientSecret;
}
catch (error) {
throw new amplify_cli_core_1.AmplifyFault('ServiceCallFault', {
message: error.message,
}, error);
}
};
exports.getAppClientSecret = getAppClientSecret;
const getCognitoIdentityProviderClient = async (context) => {
const { client } = await context.amplify.invokePluginMethod(context, 'awscloudformation', undefined, 'getConfiguredCognitoIdentityProviderClient', [context]);
return client;
};
//# sourceMappingURL=get-app-client-secret-sdk.js.map