New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Cognito User pool - CognitoSyncSample #114

Closed
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@ascuderibjss

ascuderibjss commented Sep 9, 2016

  • CognitoSyncSample: Add full support for AWS 2.4.7
  • CognitoSyncSample: Add support for Cognito User pool
Add support for Cognito User pool - CognitoSyncSample
Add full support for AWS 2.4.7 - CognitoSyncSample
@blastedcoder

This comment has been minimized.

Show comment
Hide comment
@blastedcoder

blastedcoder Sep 27, 2016

@ascuderibjss I hope it is ok to contact direct, but your branch is throwing an error or I have missed a config option.

I oringinally downloaded the branch to validate my own code as when linking AWS User Pools to Federated Identities was throwing the following error.

{
    Connection = "keep-alive";
    "Content-Length" = 109;
    "Content-Type" = "application/x-amz-json-1.1";
    Date = "Tue, 27 Sep 2016 09:24:44 GMT";
    "x-amzn-ErrorMessage" = "Token is not from a supported provider of this identity pool.";
    "x-amzn-ErrorType" = "NotAuthorizedException:";
    "x-amzn-RequestId" = "3a673f77-8494-11e6-bc90-53fe585ab916";
}

This branch throws the same error.

As for my config I have done the following steps

  1. Create mobile hub account in US East 1
  2. User Sign in Required
  3. Added in Facebook
  4. Created Cognito User Pool with everything as default
  5. Added App ( copied client id and secret)
  6. Edited Federated Identity that was created by mobile hub
  7. Added User Pool ID and App Client ID
  8. Unauthenticated Roles are turned off and there is no unauthenticated role assigned.

I have added the details in to Constatns.swift
Login works fine but when linking I get the error as as above.

Thanks in advance

blastedcoder commented Sep 27, 2016

@ascuderibjss I hope it is ok to contact direct, but your branch is throwing an error or I have missed a config option.

I oringinally downloaded the branch to validate my own code as when linking AWS User Pools to Federated Identities was throwing the following error.

{
    Connection = "keep-alive";
    "Content-Length" = 109;
    "Content-Type" = "application/x-amz-json-1.1";
    Date = "Tue, 27 Sep 2016 09:24:44 GMT";
    "x-amzn-ErrorMessage" = "Token is not from a supported provider of this identity pool.";
    "x-amzn-ErrorType" = "NotAuthorizedException:";
    "x-amzn-RequestId" = "3a673f77-8494-11e6-bc90-53fe585ab916";
}

This branch throws the same error.

As for my config I have done the following steps

  1. Create mobile hub account in US East 1
  2. User Sign in Required
  3. Added in Facebook
  4. Created Cognito User Pool with everything as default
  5. Added App ( copied client id and secret)
  6. Edited Federated Identity that was created by mobile hub
  7. Added User Pool ID and App Client ID
  8. Unauthenticated Roles are turned off and there is no unauthenticated role assigned.

I have added the details in to Constatns.swift
Login works fine but when linking I get the error as as above.

Thanks in advance

@ascuderibjss

This comment has been minimized.

Show comment
Hide comment
@ascuderibjss

ascuderibjss Sep 27, 2016

Hi @blastedcoder.
Check you have the latest branch, because yesterday I fixed something.
I've tested with my constants and it works fine. I'm using Xcode 8, Swift 2.3.
In order to work with Xcode 8, you need to enable the Keychain Sharing capability in the CognitoSyncDemo target.

I've updated AWS to 2.4.9 using: pod update

Check that you have set the following:
static let COGNITO_REGIONTYPE = AWSRegionType.USEast1
static let COGNITO_IDENTITY_POOL_ID = "..." //Yours on Federated Identity -> Identity Pool Id
static let COGNITO_IDENTITY_USER_POOL_ID = "..." //Yours on User Pool -> Pool Id
static let COGNITO_IDENTITY_USER_POOL_APP_CLIENT_ID = "..." //Yours on User Pool -> Apps -> App Client Id
static let COGNITO_IDENTITY_USER_POOL_APP_CLIENT_SECRET = "..." //Yours on User Pool -> Apps -> App Client Secret

In Info.plist:
Url Schemes change fb############ with your Facebook App Id
set FACEBOOK_APP_ID
set FACEBOOK_DISPLAY_NAME

Note
I've tried with unauthenticated enabled and disabled in AWS Federated Identity and it works.
I have created both authenticated and unauthenticated roles.
Check that your user has a CONFIRMED status in AWS User Pool console.

ascuderibjss commented Sep 27, 2016

Hi @blastedcoder.
Check you have the latest branch, because yesterday I fixed something.
I've tested with my constants and it works fine. I'm using Xcode 8, Swift 2.3.
In order to work with Xcode 8, you need to enable the Keychain Sharing capability in the CognitoSyncDemo target.

I've updated AWS to 2.4.9 using: pod update

Check that you have set the following:
static let COGNITO_REGIONTYPE = AWSRegionType.USEast1
static let COGNITO_IDENTITY_POOL_ID = "..." //Yours on Federated Identity -> Identity Pool Id
static let COGNITO_IDENTITY_USER_POOL_ID = "..." //Yours on User Pool -> Pool Id
static let COGNITO_IDENTITY_USER_POOL_APP_CLIENT_ID = "..." //Yours on User Pool -> Apps -> App Client Id
static let COGNITO_IDENTITY_USER_POOL_APP_CLIENT_SECRET = "..." //Yours on User Pool -> Apps -> App Client Secret

In Info.plist:
Url Schemes change fb############ with your Facebook App Id
set FACEBOOK_APP_ID
set FACEBOOK_DISPLAY_NAME

Note
I've tried with unauthenticated enabled and disabled in AWS Federated Identity and it works.
I have created both authenticated and unauthenticated roles.
Check that your user has a CONFIRMED status in AWS User Pool console.

@blastedcoder

This comment has been minimized.

Show comment
Hide comment
@blastedcoder

blastedcoder Sep 27, 2016

@ascuderibjss

Thanks I will do. It is now working, but I weirdly had to do the following steps an no code changes.

Remove Facebook from Federated Identity - Authentication providers
Save so just Cognito is set
Re-add Facebook back in

All works fine, I am not sure if this is because it was originally set up using MobileHub

blastedcoder commented Sep 27, 2016

@ascuderibjss

Thanks I will do. It is now working, but I weirdly had to do the following steps an no code changes.

Remove Facebook from Federated Identity - Authentication providers
Save so just Cognito is set
Re-add Facebook back in

All works fine, I am not sure if this is because it was originally set up using MobileHub

@blastedcoder

This comment has been minimized.

Show comment
Hide comment
@blastedcoder

blastedcoder Oct 4, 2016

@ascuderibjss

I have tested it and the code appears to all be working fine. That being said my code works fine too.

blastedcoder commented Oct 4, 2016

@ascuderibjss

I have tested it and the code appears to all be working fine. That being said my code works fine too.

@ascuderibjss

This comment has been minimized.

Show comment
Hide comment

@kvasukib kvasukib self-requested a review Sep 19, 2017

@johndpope

This comment has been minimized.

Show comment
Hide comment
@johndpope

johndpope Feb 21, 2018

close this due to code rot - missing swift 3 branch.

johndpope commented Feb 21, 2018

close this due to code rot - missing swift 3 branch.

@minbi

This comment has been minimized.

Show comment
Hide comment
@minbi

minbi Jul 27, 2018

Contributor

Thanks for the pull request. We now recommend using AWS AppSync for new customers.

Contributor

minbi commented Jul 27, 2018

Thanks for the pull request. We now recommend using AWS AppSync for new customers.

@minbi minbi closed this Jul 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment