Azure-Samples / active-directory-b2c-ios-swift-native-msal

An iOS sample in Swift that authenticates Azure AD B2C users and calls an API using OAuth 2.0
https://aka.ms/aadb2c
MIT License
45 stars 22 forks source link

New user login #30

Closed GithubAshishHere closed 4 years ago

GithubAshishHere commented 4 years ago

In short why I need to kill application to log in with Use another account. How can I login with another account without kill the application? Waiting for the response. Thank you.

jennyf19 commented 4 years ago

fyi: @oldalton

oldalton commented 4 years ago

Is this the same issue? https://github.com/AzureAD/microsoft-authentication-library-for-objc/issues/850.

GithubAshishHere commented 4 years ago

Yes, I check all SDK. Same issue. I'm getting. Step-1: log in with a new email I'd. Step-2: After successful login with the first email you will get two options one already signed in email option and another "Use another account". Step-3: Click on Use another account. Enter a new email and press next. You now got successfully signed in with the first email I'd. Why it's not getting or asking for the password of a new enter email?

But the same process is working if I kill the application and follow the step-3. Now it's asking for the password and login with entering email I'd.

Means kill the application and restart the application it's work fine for Use another account option. But without kill application an try to login with another account. It has issue. yes, my email has the same domain name.

  1. abc@test.com
  2. xyz@test.com

Thank you. I hope you understand.

GithubAshishHere commented 4 years ago

Waiting for your response. Thank you

oldalton commented 4 years ago

Can you try following:

MSALInteractiveTokenParameters *parameters = [[MSALInteractiveTokenParameters alloc] initWithScopes:@[...]  webviewParameters:webviewParameters];
parameters.promptType = MSALPromptTypeLogin;
[application acquireTokenWithParameters:parameters completionBlock:completionBlock];
GithubAshishHere commented 4 years ago

Hello, Madam I coded like this. is it the wrong way?

MSALInteractiveTokenParameters *interactiveParams = [[MSALInteractiveTokenParameters alloc] initWithScopes:scopes webviewParameters:webParameters]; [interactiveParams setPromptType:MSALPromptTypeSelectAccount];

GithubAshishHere commented 4 years ago

Sorry, madam your sign way of prompt not working. interactiveParams.promptType = MSALPromptTypeLogin; But You assign like below code it's going to prompt mode. [interactiveParams setPromptType:MSALPromptTypeSelectAccount]; But my issue is when I set prompt type. we have the two options already signed in email and another option is "Use another account". If you open just fresh application and click on use another account. You will get one screen where you have to enter an email. after clicking the next button then you get a new screen where email already copies from a recent email, you enter. In the second screen, you have to enter the password and submit. Now you will get successfully login with entering email. Now the issue starts. Don't kill the application again try to login with using another account option. On click of that option. You will get enter email address screen up to this it's working perfectly. But after enter the new email address and click on next. It's never forwarded to a new enter email screen (Means not going to the password asking screen) and it's automatically signed in with already last signed in account and give its result. Please let me know if you have any queries. Thank you. madam. Please support me to resolve this issue. Have a great day.

oldalton commented 4 years ago

Closing as duplicate of https://github.com/AzureAD/microsoft-authentication-library-for-objc/issues/850. Let's track that issue in MSAL repository.