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

How can I prevent login_hint to be added to URL when loginRedirect() is called? #1865

Closed
1 of 5 tasks
lidermanrony opened this issue Jul 1, 2020 · 4 comments
Closed
1 of 5 tasks
Assignees
Labels
msal@1.x Related to msal@1.x (implicit flow) question Customer is asking for a clarification, use case or information.

Comments

@lidermanrony
Copy link

lidermanrony commented Jul 1, 2020

Library

  • msal@1.x.x or @azure/msal@1.x.x
  • @azure/msal-browser@2.x.x
  • @azure/msal-angular@0.x.x
  • @azure/msal-angular@1.x.x
  • @azure/msal-angularjs@1.x.x

Description

When my users want to switch to another account, I want to redirect them to the general AAD login page where they can enter their email and password.

The problem is that when i call loginRedirect(), msal.js always appends a login_hint that has the currently logged-in account.

This logic happens in ServerRequestParameters.addHintParameters.

Is there a way to make msal js not provide the login hint?

A possible workaround is to use select_account instead of login in prompt, but I'm already using Me control for account switching from within my app (without needing to redirect), so I'm interested in redirecting to user/password entry rather than a "pick an account" UX.

@lidermanrony lidermanrony added the question Customer is asking for a clarification, use case or information. label Jul 1, 2020
@lidermanrony lidermanrony changed the title How can I prevent login_hint to be added to URL when login() is called? How can I prevent login_hint to be added to URL when loginRedirect() is called? Jul 1, 2020
@jmckennon
Copy link
Contributor

You can try calling logout() before calling loginRedirect(), maybe with some logic to detect if there is a user currently logged in.

@jmckennon jmckennon self-assigned this Jul 1, 2020
@jmckennon jmckennon added the msal@1.x Related to msal@1.x (implicit flow) label Jul 1, 2020
@lidermanrony
Copy link
Author

Thanks, Is there any other option? logging out is kind of a last resort since it affects other browser tabs / applications

@lidermanrony
Copy link
Author

OK i think i can use onRedirectNavigate to remove the login hint and redirece myself.
Is that a good solution?

@jmckennon
Copy link
Contributor

Sorry for the delay over the long weekend. Yes--onRedirectNavigate allows you to control the redirect yourself, so your solution should definitely be possible. More info on that in #1691

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
msal@1.x Related to msal@1.x (implicit flow) question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

2 participants