Failed to integrate AWS Cognito SDK in latest Kony Visualizer (SP4 FP54)

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

The awsDemo sample has been out of date.

So I followed the guide of https://github.com/aws-amplify/amplify-js/tree/master/packages/amazon-cognito-identity-js and try to integrate it into my Kony native App, but get stopped by error 'fetch is undefined'.

And also I failed with trying to use npm & webpack to pack a Kony require module to solve the dependency issue. Could you let me know, is the Kony development possible to cooperate with npm & webpack?

@Rexeccv Wilson​ Can you help here?

@Gvxwielle Young​ Kony Native Frameworks support requirejs way of loading js modules.

I see AWS Cognito SDK has requirejs definitions.

Try the following steps and see if it works for you:

  • Download AWS Cognito SDK using npm: npm install amazon-cognito-identity-js
  • SDK is located in dist folder: node_modules/amazon-cognito-identity-js/dist/amazon-cognito-identity.js
  • Copy this file and add it to `modules/require' folder in Visualizer project
  • Consume it in you app logic using requirejs(['./amazon-cognito-identity'], function(AmazonCognitoIdentity) { //your logic })

"amazon-cognito-identity-js" requires a polyfill of Fetch API on a target other of "Web", like "Node".

I have tried "node-fetch" but seems not work in Kony.

Do you have any idea?

@Gvxwielle Young​ Kony apps run on phone's JS engine and its not exactly a node environment. On Android js run on V8 engine but it doesn't have a node environment.

@Cvwol Duncvn​ Please provide info on any adapters available for latest AWS SDK for Kony framework.