iosobjective-ciphoneamazon-web-servicesaws-mobilehub

iOS - AWS MobileHub sign in with developer authenticated provider


I'm trying to understand how to sign in with a developer authenticated identity using AWS mobilehub's iOS SDK as recently AWS changed this SDK and I cannot find any documentation on this. The sample app fails to shed any light on this.

I have a REST API to retrieve the cognito ID and Token but I'm not sure what to do with them once I have this.

AWS has the following different classes that futher complicate the issue:

AWSCredentialsProvider, AWSCognitoCredentialsProvider (No longer available in new SDK), AWSSignInProvider, AWSAbstractCognitoIdentityProvider (no longer available in new SDK)

There's now something called AWSAbstractCognitoIdentityProviderHelper..

These are handled by the AWSIdentityManager which is part of AWSMobileHubHelper.framework however AWSIdentityManager doesn't let you set the credentials provider so I don't understand how I am meant to interact with it in this regard.

Any tutorials, documentation, etc. would be much appreciated


Solution

  • Your question exposes certain terminology problems:

    3 ways to use Cognito

    You must understand that there are 3 different interface apis.

    1. COGNITO API and up to date API documentation (the RESTFUL interaction)
    2. iOS SDK and out of date SDK documentation (the SDK is not RESTFUL, it has ton's of state).
    3. Mobile Hub Helper (MHH) SDK - MHH is documented (a little) by the hub, and pretty well in the .h files used to produce appledoc documentation.

    With respect to Identity and SignIn/Authentication (the topics of this question) aws-mobile-hub-helper (hereafter MHH) has an elegant design and works well. I would recommend anyone using Cognito start with the Mobile Hub site (or at least with aws-mobile-hub-helper). The MHH is basically a wrapper to the SDK and helps clarify and separate the issues of persistent federated identity and credentials/authorization for AWS services from issues of Identity, authentication and attributes/claims for that Identity.

    The mobile-hub-helper is documented only in the .h files. These can be processed into documentation by appledocs, and the comments there are pretty good if you had an overview of the class structure (which does not exist but I will attempt to provide).

    SDK Authentication Flow

    The authentication flow documented by AWS, is an oversimplification and does not aid in understanding how the authentication is accomplished using the SDK and Mobile Hub Helper. The following diagrams attempt to convey how identity authentication(login) and authorization(credentials) to use AWS Services (like S3, and DynamoDB) works.

    Cognito SDK Authentication Flow (Single Identity Provider) Cognito SDK Authentication Flow (Multiple Identity Provider)

    Understanding Cognito

    Cognito Naming

    Glossary/Synonyms

    These terms are used loosely throughout the AWS documentation and marketing material. This is an attempt to sort out the terminology by grouping terms that are used interchangeably by AWS.

    IdentityId Behaviors

    AWSIdentityProviderManager

    About Merging Identities

    Where Cognito buries its data