How to use the @aws-amplify/core.Signer.sign function in @aws-amplify/core

To help you get started, we’ve selected a few @aws-amplify/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-js / packages / api / src / RestClient.ts View on Github external
const endpoint_service: string = this._service || this._options.service;

        const creds = {
            secret_key: credentials.secretAccessKey,
            access_key: credentials.accessKeyId,
            session_token: credentials.sessionToken,
        };

        const endpointInfo = {
            region: endpoint_region,
            service: endpoint_service,
        };

        const signerServiceInfo = Object.assign(endpointInfo, signerServiceInfoParams);

        const signed_params = Signer.sign(otherParams, creds, signerServiceInfo);

        if (signed_params.data) {
            signed_params.body = signed_params.data;
        }

        logger.debug('Signed Request: ', signed_params);

        delete signed_params.headers['host'];
        return axios(signed_params)
            .then(response => isAllResponse ? response : response.data)
            .catch((error) => {
                logger.debug(error);
                throw error;
            });
    }
github aws-amplify / amplify-js / packages / api / src / RestClient.ts View on Github external
secret_key: credentials.secretAccessKey,
			access_key: credentials.accessKeyId,
			session_token: credentials.sessionToken,
		};

		const endpointInfo = {
			region: endpoint_region,
			service: endpoint_service,
		};

		const signerServiceInfo = Object.assign(
			endpointInfo,
			signerServiceInfoParams
		);

		const signed_params = Signer.sign(otherParams, creds, signerServiceInfo);

		if (signed_params.data) {
			signed_params.body = signed_params.data;
		}

		logger.debug('Signed Request: ', signed_params);

		delete signed_params.headers['host'];
		return axios(signed_params)
			.then(response => (isAllResponse ? response : response.data))
			.catch(error => {
				logger.debug(error);
				throw error;
			});
	}