Cognito login example using SWIFT & Facebook

I am trying to create a sample iOS app to enumerate S3 bucket after login from facebook using amazon cognito. unfortunately I can't find examples for cognito fast authentication via facebook. The one in the example does not take into account the authentication part.

Can anyone provide some sample code for this.

So bad that Amazon isn't even a good example for quick coverage of basic services.

+3


source to share


2 answers


// Set the AWS credentials provider to use Facebook auth token
let credentialProvider = AWSCognitoCredentialsProvider(
    regionType: CognitoRegionType, 
    identityPoolId: CognitoIdentityPoolId)
let logins: NSDictionary = NSDictionary(dictionary: 
    ["graph.facebook.com" : self.fbToken])
credentialProvider.logins = logins as [NSObject : AnyObject]
credentialProvider.refresh()
let configuration = AWSServiceConfiguration(
    region: DefaultServiceRegionType,
    credentialsProvider: credentialProvider)

AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration

      



Where self.fbToken is the Facebook token and CognitoRegionType, CognitoIdentityPoolId and DefaultServiceRegionType are all defined constants.

+5


source


There is currently one Swift example in the AWS iOS Sample Repository, but this is for the SNS demo. It doesn't show S3 or Facebook login, but it does show Cognito.



https://github.com/awslabs/aws-sdk-ios-samples/tree/master/SNS-MobileAnalytics-Sample/Swift/

+2


source







All Articles