LambdAuth
LambdAuth copied to clipboard
iOS Implementation
Thanks for a great package. I am wondering if you have any guidelines/tips for a beginner to implement the APIs in iOS? Any tip or push in a direction is appreciated!
Thanks
Hello, I would recommend starting with Cognito sample generated by AWS Mobile Hub. From then you can just emulate the same UI that actually is provided as web and call Lambda functions directly from mobile client using AWS SDK. Considering the login flow, once you obtain the token from developer authentication you have to set it to the Cognito in order to trigger the functions.
How do you guys refresh credentials once they expire? Save password locally (unsafe)?
@aletheia Sorry for late answer I missed out on your response, thank you! I managed to learn some more about it in meanwhile too :) cheers
@sneakr Did you have any luck implementing this on iOS. I've just been trying to adopt the latest AWS Swift code sample to use this. Replacing their AWSTask with a AWSLambdaInvoker AWSTask. I sort of get the login to work and a token back, but struggling to integrate this with the rest of the code. I also find that this AWSLambdaInvoker just works the first time, then returning error 2.
Any samples, or tutorials you might be able to point me to would be much appreciated.
@helloniklas Unfortunately I had to find someone to set up our own backend server and backend code on an Amazon EC2 , since I had struggle getting things working in the matter I wanted to.
When it comes to the cognito implementation in iOS managed to solve it by using this line of code:
DeveloperAuthenticationResponse *authResponse = [DeveloperAuthenticationResponse new];
authResponse.token = yourCognitoTokenResponseHere; authResponse.identityId = yourIdentityIdHere; authResponse.identityPoolId = CognitoIdentityPoolId;
... where I set the values manually from my own response. You can find this line of code from Amazon iOS Cognito Samples.
GL :)
@sneakr Thanks for that. Although I still have ongoing issues with this. Seems you have to set up an API Gateway for this to work, as per this post, http://baczuk.com/2015/12/AWS-Cognito-in-Swift/
Has anyone managed to use this LambdAuth successfully from an iOS app?
If anyone else is attempting this, I now managed to resolve the issues I had. Turns out it doesn't work to call the Lambda Invoker form the AWS SDK when calling the LambdAuthLogin but this has to be done through an API Gateway. See this post, http://baczuk.com/2015/12/AWS-Cognito-in-Swift/
After settings up the API Gateway with POST resources pointing to the various Lambda functions I'm now able to successfully login.
I am trying to attempt this to make this an iOS app. Has anyone had luck modifying it? I used Parse but since that is shutting down I'm switching to AWS.
I am also going to attempt to modify it to remove the verify email first too.
I don't know why AWS make the login so difficult. In my case I was trying to use Facebook + AWS Cognito and I have successfully create a connection between those two. however the problem is how do we keep that track of the CurrentUser id?
@LamourBt I, too, am trying to use Facebook and Google with this. Were you able to come around it? If yes would be great if you can give a little insight.
Hi! With LambdAuth you can manage Developer Authenticated Identities. For an example is iOS (Objective-C or Swift) and Android, please use the AWS Mobile Hub to create a sample/starting app: https://aws.amazon.com/mobile/
On Wed, Mar 30, 2016 at 8:26 PM, Hardik Shah [email protected] wrote:
@LamourBt https://github.com/LamourBt I, too, am trying to use Facebook and Google with this. Were you able to come around it? If yes would be great if you can give a little insight.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/danilop/LambdAuth/issues/15#issuecomment-203567758
@danilop so what your are saying is to enable users to login via FB, Google, one will have to write lambda function, dedicated to each, kind of on the lines of what you already have here?
AWS Mobile Hub supports login via FB, Google (others are coming) out of the box.
If you add a custom authentication (such as LambdAuth) you can reuse the coe that is already there. You will need to implement a log in form with user/password and the call to the LambdAuthLogin Lambda function to do the login and get back the authentication token for Amazon Cognito.
AWS Mobile Hub can also set up permissions and code to cal a Lambda function, so you can resume that, too.
On Thu, Mar 31, 2016 at 4:34 PM, Hardik Shah [email protected] wrote:
@danilop https://github.com/danilop so what your are saying is to enable users to login via FB, Google, one will have to write lambda function, dedicated to each, kind of on the lines of what you already have here?
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/danilop/LambdAuth/issues/15#issuecomment-203967315
Hi @danilop,
How do I setup permissions to call Lambda functions in the AWS Mobile Hub?
Thanks
You just need to select the functions you want to call from the mobile app in the cloud logic section. Mobile Hub takes care of configuring permissions for you.
On Wed, Apr 6, 2016 at 6:33 PM, Franky Liang [email protected] wrote:
Hi @danilop https://github.com/danilop,
How do I setup permissions to call Lambda functions in the AWS Mobile Hub?
Thanks
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/danilop/LambdAuth/issues/15#issuecomment-206452167
So after setting it up, I would call the functions as usual with Lambda Invoker? And where would I be able to access the generated users on Mobile Hub?
Thank you.
I like the LambdAuth... code is great.
But it seems that AWS login integration for Developer Authenticated Provider is fairly a random poking around in the dark. I have wasted a lot of time. My project is suffering.
Question #1: When using the Mobile Hubto generated the login code, is the expectation that we provide a AWSSignInProvider to (void)handleLoginWithSignInProvider:?
I have had better luck bypassing that handler, but am having trouble getting AWS resources (namely S3) to recognize an authorized login, even tho I have received a token from my LambdAuthLogin (thanks @danilop). So wondering should I try harder to make (void)handleLoginWithSignInProvider: work with my Developer Authenticated Provider? My FB login is recognized as Authorized and can access resources. However my Developer Authenticated login is not recognized as Authorized and is denied resources.