AWS SDK with ionic 2


#1

Hi,

I was trying to use aws-sdk with ionic 2, but wasn’t successful.

Has anyone tried to use aws-sdk with ionic 2?

Following steps:

npm i aws-sdk

created a provider that required ‘aws-sdk’.

used that provider within other page.

The call is happening fine but the actual operations with AWS are not happening.

Like creating a bucket in S3 is not returning any error code nor is the operation successful.


#2

same here,did you solved that ? how to use aws-sdk with ionic 2 ?


#3

I need it to, if someone can help us :wink: ?


#4

It looks like we are the only ones who are looking to use AWS SDK with ionic 2.

I hope there is someone in the community who has successfully used it and can help us.


#5

I am using AWS SDK into ionic 2,let me know your specific question so i can give answer of question

However i am using lambda and i am able to get response from aws but after got success i am trying to change page using this.nav.push(pagename); but it shows push is undefined do you know why i am getting this error ?


#6

Hi. I am building an project where I’ve used Raspberry PI. I have used AWS IoT SDK for javascript and placed it in the Raspberry PI memory.

On the app side, I am using Ionic 2. But I am trying to use AWS IoT Javascript(Nodejs) SDK in the ionic project. Is it possible?

If so, then please walk me through.
I am using Raspberry PI to connect through AWS IoT. The connection between AWS IoT and Raspberry PI is successful. But I cannot understand how can I connect ionic app to AWS IoT.

Is AWS Lambda or AWS SNS play role here for connectivity?


#7

I created a sample ionic 2 app that integrates nicely with AWS’s Cognito User Pools Service:

I’m using the aws javascript sdk.

Try it out – it’s a fully-functioning app right now. You can easily add the S3 component.

Good luck.


#8

@odessitv I’ve looked at both your Angular 2 and Ionic 2 AWS Cognito apps as they seem to be the only real relevant examples I’ve been able to find. I did have some questions though as some of it appeared to go against best practices guidance I have found and I also saw that you included the JS files under assets/ rather than making use of the NPM packages available for them.


#9

@odessitv I haven’t looked at your library yet. But I wonder if you have tested in iOS on a live device. I also built out an AWS backend with Cognito. But when I deploy to the device, the login times are REALLY SLOW. I did some research and folks are pointing to the UIWebView performance when doing the crypto work for the login as the culprit. I am planning to try the WKWebView plugin as a work around. But wondering if you have seen any iOS performance issues?


#10

Quick follow-up for anyone that stumbles on this thread. I tested the repo presented by @odessitv and it does run very slow when using the UIWebView in iOS. I was able to install the WKWebView plugin and the speed improve dramatically. The problem for me is that my project crashes w/ $rootScope:infdig messages during startup after I install the WKWebView plugin. Uugghh! So, this solution still requires a some troubleshooting for me. I am thinking about changing course and writing a cordova plugin that uses the native iOS SDK from AWS for the cognito stuff…


#11

Well, that was a big waste of time. I worked w/ the native AWS SDK in objective-c to get a basic set of features written: init, login, refresh, and logout. This all works well in a single ViewController native app. I have basic buttons to login, logout and refresh. I can see the same tokens returned on the refresh call until I get inside of 5min of the expiration time (1 hour). Then, it uses the refresh token under the covers to get a new set of tokens. This is all wrapped in a Cognito class that I wrote.

The problem comes when I wrap this class in a cordova plugin. The init and plugin code runs fine. But, the refresh errors out with the message “Authorization delegate not set”. This appears to be some sort of internal state this is lost between the login call and the refresh call. I have looked into the source for the AWS SDK and can see a spot where it calls the delegate if the expirationTime or tokens are missing, which generates the error because I do not set the delegate.

I saw a mention from @max on the github repo for the Ionic/AWS reference app about this issue. @max and chance you could share some details of any work you have going on the use of native code to do the login logout. I am very eager to fix the issue as I feel that the AWS back-end/Ionic front-end stack is a really compelling tech set. I would love to share what I have for native code and my “broken” plugin work to try and get to a final point where there is a plugin to provide tokens for working w/ the AWS API gateway (or other services that need an idToken).