Skip to content
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

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

Open
BigVeila opened this issue Sep 18, 2024 · 9 comments
Open

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

BigVeila opened this issue Sep 18, 2024 · 9 comments
Labels
auth question General question

Comments

@BigVeila
Copy link

BigVeila commented Sep 18, 2024

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:

  • SDK Version: AWSMobileClient (2.35.0)
  • Dependency Manager: Cocoapods
  • Swift Version : 5.9.2

Device Information (please complete the following information):

  • Device: iPhone 11 (iOS 16.5.1)
  • Simulator: iPhone 15( iOS 17.2)
    Screenshot 2024-09-18 at 09 07 42

Thanks you!

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending response from an Amplify team member labels Sep 18, 2024
@phantumcode
Copy link
Member

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

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 18, 2024
@phantumcode phantumcode added bug Something isn't working pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-maintainer-response Issue is pending response from an Amplify team member labels Sep 18, 2024
@harsh62
Copy link
Member

harsh62 commented Sep 18, 2024

@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.

@phantumcode phantumcode added question General question pending-community-response Issue is pending response from the issue requestor and removed bug Something isn't working pending-triage Issue is pending triage labels Sep 18, 2024
@BigVeila
Copy link
Author

@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?

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Sep 19, 2024
@phantumcode
Copy link
Member

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

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 19, 2024
@phantumcode phantumcode added the pending-community-response Issue is pending response from the issue requestor label Sep 19, 2024
@BigVeila
Copy link
Author

BigVeila commented Sep 20, 2024

@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

@github-actions github-actions bot added pending-maintainer-response Issue is pending response from an Amplify team member and removed pending-community-response Issue is pending response from the issue requestor labels Sep 20, 2024
@BigVeila
Copy link
Author

@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?

@harsh62
Copy link
Member

harsh62 commented Sep 20, 2024

without options: .preferPrivateSession()

This is because you are already into the identity provider. The sign out only signs you out from Cognito and not the identity provider.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 20, 2024
@BigVeila
Copy link
Author

@harsh62 So is there any way for me to completely sign out? Or is the only option to use preferPrivateSession()?

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 23, 2024
@harsh62
Copy link
Member

harsh62 commented Sep 23, 2024

@BigVeila .. I would like to refer you to this comment I made on another issue which is similar to what you are seeing.
aws-amplify/amplify-swift#3593 (comment)

I would suggest you to use private session if you want the user to be not automatically logged in if they haven't logged out of the idp.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth question General question
Projects
None yet
Development

No branches or pull requests

3 participants