AWS Cognito and Amazon API Gateway integration within Telerik NativeScript

Viewed 664

I am developing a Telerik NativeScript application with Amazon Web Services (AWS) and I am stuck on how to implement the logging method using Amazon Cognito.

I have two questions :

First - I have installed 'nativescript-aws' (an 'npm' library which integrates the 'aws-sdk' AWS JavaScript SDK for JavaScript) and it seems working on the application, but the problem comes with AWS Cognito, I have integrated AWS Cognito through 'amazon-cognito-identity-js' Amazon Cognito Identity SDK for JavaScript but when I run the application through 'tns debug android' it stucks on "Failed to find module: "crypto", relative to: app/tns_modules/"... I have made a research and it seems that NativeScript does not support Crypto JS yet.

Second - If in any chance I succeeded to run the application I want to generate an SDK through Amazon API Gateway and integrate it within my project, thoses are the files that I need to use into the project :

<script type="text/javascript" src="lib/axios/dist/axios.standalone.js"></script>
<script type="text/javascript" src="lib/CryptoJS/rollups/hmac-sha256.js"></script>
<script type="text/javascript" src="lib/CryptoJS/rollups/sha256.js"></script>
<script type="text/javascript" src="lib/CryptoJS/components/hmac.js"></script>
<script type="text/javascript" src="lib/CryptoJS/components/enc-base64.js"></script>
<script type="text/javascript" src="lib/url-template/url-template.js"></script>
<script type="text/javascript" src="lib/apiGatewayCore/sigV4Client.js"></script>
<script type="text/javascript" src="lib/apiGatewayCore/apiGatewayClient.js"></script>
<script type="text/javascript" src="lib/apiGatewayCore/simpleHttpClient.js"></script>
<script type="text/javascript" src="lib/apiGatewayCore/utils.js"></script>
<script type="text/javascript" src="apigClient.js"></script>

In summary, I want to know the best way to integrate all those libraries into my project and make it work.

1 Answers

Check out nativescript-nodeify for instructions. The cognito-specific stuff is at the very bottom. The nativescript-aws-sdk has now been deprecated so that's not a good option anymore

Related