UNPKG

@aws-amplify/amplify-category-auth

Version:

amplify-cli authentication plugin

29 lines 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAppClientSecret = void 0; const amplify_cli_core_1 = require("@aws-amplify/amplify-cli-core"); const client_cognito_identity_provider_1 = require("@aws-sdk/client-cognito-identity-provider"); const getAppClientSecret = async (context, userpoolId, clientId) => { var _a; try { const identity = await getCognitoIdentityProviderClient(context); const params = { ClientId: clientId, UserPoolId: userpoolId, }; const command = new client_cognito_identity_provider_1.DescribeUserPoolClientCommand(params); const result = await identity.send(command); 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