aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 879 forks source link

Can not get user after sign in with Apple ID #5438

Open BigVeila opened 2 days ago

BigVeila commented 2 days ago

I use AWS Cognito to sign in with Apple ID. The setup helped me successfully sign in using the function: AWSMobileClient.default().federatedSignIn(providerName: IdentityProvider.apple.rawValue, token: identityTokenString) As you can see from the log in the console.

However, I’m still encountering three issues, and I think the first two might be related:

  1. After signing in successfully, I cannot retrieve the user information when using the function AWSMobileClient.default().getUserAttributes(). I get error 26 (notSignIn??)
  2. On the AWS console, the ‘User’ tab does not show any additional users even though the sign-in was reported as successful.

I’m not sure if there is any configuration missing on the AWS Console side, but I’m confident I followed the instructions completely since the sign-in itself was successful.

Environment:

Device Information (please complete the following information):

Thanks you!

phantumcode commented 2 days ago

@BigVeila Thanks for submitting the issue. We'll work on reproducing the issue and provide an update here.

harsh62 commented 2 days ago

@BigVeila Federating into user pools is not a supported feature. What you are doing is federating into Identity Pools. Please track the feature request in Amplify for further updates on federating into user pools.

You can use WebUI API in Amplify to federate into user pools using SIWA.

BigVeila commented 1 day ago

@harsh62 thanks, I am using Amplify and I sign-in success, my user is added into user pool too. But I have more question. I can't sign out normally, I need to reset then configure Amplify again then sign-out. Do you have any idea about this?

phantumcode commented 23 hours ago

@BigVeila Can you provide your configuration file (with sensitive details redacted) and sample code on how you configuring Amplify and signing in/out?

BigVeila commented 12 hours ago

@phantumcode I have signed out successfully. Step 1 add

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>YOUR APP NAME</string>
            </array>
        </dict>
    </array>

to info.plist so you don't have to reset the configuration before signing out.

Step 2 is to add options: .preferPrivateSession() to sign-in function, so that when signing out, the alert message won't appear.

I found that there is no specific sample or tutorial, I found them by testing and researching in existing issues. AWS should add to the documentation

BigVeila commented 7 hours ago

@phantumcode I have one more question. I try to use sign-in without options: .preferPrivateSession(), then I sign-out, and sign-in again, always auto sign-in the last account. It does not show the web login any more. Do you have any idea about this?